/r/mysql

Photograph via snooOG

Discussion of MySQL and assistance for MySQL related questions

New Sidebar coming soon.

/r/mysql

41,912 Subscribers

1

mysqlclient...

hmm I need help!

I already installed mysqlclient, but whenever I try to run python manage.py makemigrations I get this error:

(I had just updated my MariaDB and I don't know if I'm facing this problem because of it or not.)

(.venv) PS C:\xampp\htdocs\Django_project> python manage.py makemigrations

Traceback (most recent call last):

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\db\backends\mysql\base.py", line 16, in <module>

import MySQLdb as Database

ModuleNotFoundError: No module named 'MySQLdb'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "C:\xampp\htdocs\Django_project\manage.py", line 22, in <module>

main()

File "C:\xampp\htdocs\Django_project\manage.py", line 18, in main

execute_from_command_line(sys.argv)

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line

utility.execute()

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\core\management\__init__.py", line 416, in execute

django.setup()

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\__init__.py", line 24, in setup

apps.populate(settings.INSTALLED_APPS)

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\apps\registry.py", line 116, in populate

app_config.import_models()

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\apps\config.py", line 269, in import_models

self.models_module = import_module(models_module_name)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Admin\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "<frozen importlib._bootstrap>", line 1387, in _gcd_import

File "<frozen importlib._bootstrap>", line 1360, in _find_and_load

File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked

File "<frozen importlib._bootstrap>", line 935, in _load_unlocked

File "<frozen importlib._bootstrap_external>", line 995, in exec_module

File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\contrib\auth\models.py", line 5, in <module>

from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\contrib\auth\base_user.py", line 40, in <module>

class AbstractBaseUser(models.Model):

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\db\models\base.py", line 143, in __new__

new_class.add_to_class("_meta", Options(meta, app_label))

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\db\models\base.py", line 371, in add_to_class

value.contribute_to_class(cls, name)

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\db\models\options.py", line 231, in contribute_to_class

self.db_table, connection.ops.max_name_length()

^^^^^^^^^^^^^^

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\utils\connection.py", line 15, in __getattr__

return getattr(self._connections[self._alias], item)

~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\utils\connection.py", line 62, in __getitem__

conn = self.create_connection(alias)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\db\utils.py", line 193, in create_connection

backend = load_backend(db["ENGINE"])

^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\db\utils.py", line 113, in load_backend

return import_module("%s.base" % backend_name)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\Admin\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\xampp\htdocs\Django_project\.venv\Lib\site-packages\django\db\backends\mysql\base.py", line 18, in <module>

raise ImproperlyConfigured(

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.

Did you install mysqlclient?

11 Comments
2024/12/02
19:54 UTC

1

Forgot MySQL Root Password on Mac M1 – Need Help Resetting It

Hi everyone,

I’ve encountered a problem with MySQL on my Mac M1. I set up MySQL a long time ago but have since forgotten the root password. I’ve tried several methods to reset it, but nothing seems to work, and I’m still being prompted for the root password.

Here’s what I’ve done so far:

  1. Uninstalled MySQL using Homebrew.
  2. Reinstalled MySQL via Homebrew (brew install mysql).
  3. Tried starting MySQL in safe mode using --skip-grant-tables, but I’m still facing issues.
  4. Even though I removed all old MySQL directories, it still asks for the password when I try to access MySQL.

Here’s the error message I get:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Is there a way to completely reset the root password or any additional steps I might have missed? Any advice on what to do next would be greatly appreciated!

Thanks in advance!

3 Comments
2024/12/02
12:58 UTC

1

Cannot use mysql connector to create database.

import mysql.connector

db = mysql.connector.connect(

host = "localhost",

user ="root",

passwd = "1234"

)

mycursor = db.cursor()

mycursor.execute("CREATE DATABASE testdatabase")

it is not creating the database testdatabase as it is intented to do.

13 Comments
2024/12/01
16:28 UTC

0

fucking xampp making me reinstall everytime because i cant fucking start MySQL database server

the title, why is Xampp SO FUCKING SLOW

5 Comments
2024/12/01
10:26 UTC

3

Updating a Derived Table

I have the following endpoint for retrieving all my inventory to display. It is a derived table. How do I make a query to update the information of a table that is derived of different tables?

Below is the SQL command to retrieve everything, what SQL command structure should I look into in order to make POST, UPDATE, and DELETE endpoints?

app.get("/inventory", (req, res)=>{
const q = "SELECT s.StoreName, s.Location, p.ProductName, i.StockQuantity, i.ReorderLevel FROM store s JOIN inventory i ON s.StoreID = i.StoreID JOIN product p ON i.ProductID = p.ProductID;";
db.query(q,(err, data)=>{
if(err)
return res.json(err)
return res.json(data) }) })

Edit: I figured it out!!! Anyway, here's my relational schema. And below I posted how I added Update functionality to my web app.

Relational Schema

brand(BrandID, BrandName, IsPrivateLabel)

customer(CustomerID, Name, Email, PhoneNumber, Address, IsFrequentShopper)

inventory(StoreID, ProductID, StockQuantity, ReorderLevel, Price)

marketbasket(BasketID, PurchaseDate)

product(ProductID, ProductName, UPC, Size, Price)

producttype(ProductTypeID, ProductTypeName)

store(StoreID, StoreName, Location, HoursOfOperation)

vendor(VendorID, VendorName, ContactInfo)

weborder(OrderID, OrderDate, CustomerID, DeliveryAddress)

Primary-keys: 

  • BrandID is the P.K. for brand
  • CustomerID is the P.K. for customer
  • StoreID and ProductID are the P.K.’s for inventory
  • BasketID is the P.K. for marketbasket
  • ProductID is the P.K. for product
  • ProductTypeID is the P.K. for producttype
  • StoreID is the P.K. for store
  • VendorID is the P.K. for vendor
  • OrderID is the P.K. for weborder

Foreign-key Constraints: 

  • StoreID and CustomerID are foreign-keys for the marketbasket table
  • ProductTypeID and BrandID are foreign-keys for the product table
  • ProductID is a foreign-key for the producttype table

So, what I did was : )

//Reorder items!
app.put("/reorder/:ProductID", (req, res) => {
    const productId = req.params.ProductID;
    const q = "UPDATE inventory SET `StockQuantity`= ? WHERE ProductID = ?";
  
    const values = [
      req.body.StockQuantity
    ];
  
    db.query(q, [...values,productId], (err, data) => {
      if (err) return res.send(err);
      return res.json(data);
    });
  });
2 Comments
2024/11/30
22:03 UTC

0

Should I use .dmg file or Homebrew to install MySQL on Mac (Sequoia 15)?

I had first used homebrew to install MySQL 8.0 before. I forgot why I didn't like it, so I resolved to use the .dmg file to install. Then after upgrading to 8.4, I started having problems of server failing to start.

Since MySQL 9.1 is out, and MacOS is upgraded to Sequoia (15), I am thinking about reinstall it. My questions are

1.) Which version of MySQL would you recommend for MacOS 15 (x86)? My hardware is iMac Pro 2017.

2.) Use .dmg or homebrew to install it?

4 Comments
2024/11/30
16:36 UTC

0

My laptop too old to download mysql, help!

Hi everybody, I need to download MySQL for an online course I'm doing. However my MacBook is too old to update to macOS 13 or 14, so I can't download MySQL. Somebody recommended using myComplier but I couldn't create a database, only the tables, and realised that if I save something it saves to general public rather than private.

Does anybody have any advice?

5 Comments
2024/11/30
11:01 UTC

0

Help MySQL workbench won't work. It's been 3 hrs

For some reason in command line i was able to get in and change passwords for root and the other host names but mySQL work bench still wont work.
I remember setting the password to 123 or 12345 and tried every other simple passwords but still cant get in.

I was able to use it without any problem before and didn't require password for me to use it but now its asking for one.

I don't get the tutorials because theyre using MYSQL 80 and mine is MYSQL 91 and I'm not literate enough to know how to adjust to that. They're also talking about .ini files but for some reason in my folder there isn't and using the the safe mode isn't letting me in MYSQL either

It's been like 3 hours I'm having difficulties

Using Local host

Edit: i gave up and just redownloaded and it got fixed lol

1 Comment
2024/11/30
05:12 UTC

0

Inner Join Question

The Employee table has the following columns:

  • ID - integer, primary key
  • FirstName - variable-length string
  • LastName - variable-length string
  • ManagerID - integer

Write a SELECT statement to show a list of all employees' first names and their managers' first names. List only employees that have a manager. Order the results by Employee first name. Use aliases to give the result columns distinctly different names, like "Employee" and "Manager".

Hint: Join the Employee table to itself using INNER JOIN.

Select FirstName, ManagerID

From Employee As E

Inner Join Employee As M

ON E.FirstName = M.FirstName

ORDER BY FirstName;

ERROR 1052 (23000) at line 2: Column 'FirstName' in field list is ambiguous

15 Comments
2024/11/29
21:01 UTC

1

Project buddy

I am looking for a person to help work on projects for the first time since reading SQL syntax. I will be using MySql, so it would be really helpful to find someone using the same to easily help each other.

4 Comments
2024/11/29
20:08 UTC

0

Missing MySQL 8.0 my.ini file & root password

Hi, as the title says I am missing both my MySQL Server 8.0\bin my.ini file, as well as when I reinstalled it today it did not let me set a password, I previously had it installed about a year ago, and I have not had any luck guessing my password. Every source I can find online to recover my.ini and to reset or recover my password rely on me only being missing one or the other. A fresh install is an option, as I have no data in there, but that is what I did today and am unsure why my password was saved from so long ago :')

I'm running Windows 10 x64, this database is just for a personal project I'm running locally.

A few of the things I have tried so far:

hidden files are shown in my file explorer- no file called my.ini exists within the MySQL folder, but mypy.ini does.

running:
mysqld --init-file=C:\\mysql-init.txt
results in the following warnings (timestamp data removed):
[System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.40) starting as process 8660

[Warning] [MY-010091] [Server] Can't create test file C:\Program Files\MySQL\MySQL Server 8.0\data\mysqld_tmp_file_case_insensitive_test.lower-test

[Warning] [MY-010091] [Server] Can't create test file C:\Program Files\MySQL\MySQL Server 8.0\data\mysqld_tmp_file_case_insensitive_test.lower-test

[ERROR] [MY-013276] [Server] Failed to set datadir to 'C:\Program Files\MySQL\MySQL Server 8.0\data\' (OS errno: 2 - No such file or directory)

[ERROR] [MY-010119] [Server] Aborting

[System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.40) MySQL Community Server - GPL.

attempting to start a server from within the 8.0 workbench results in an infinitely stuck program (really, I left it running like that for over 3h at one point I was extremely exhausted by then)

I have attempted 3x now to follow the tutorial that got copy-pasted into the comments of this thread within this community, and have not found any way to recover my.ini without knowing your root password (what I'm missing as well): https://www.reddit.com/r/mysql/comments/v8poga/forgot_the_password/

2 Comments
2024/11/29
11:15 UTC

1

Recover SQL tabs

I´m new to MySQL and i´ve been doing some tarea there, but a few hours ago I was watching a video that my teacher send me explaining how to do the assignment of this week, but I close the workbench and when I came back all the tabs disappeared, and I havent found a solution, pls help.

6 Comments
2024/11/29
04:50 UTC

2

Program code via database columns?

I'm looking for a solution or common approaches to having a database driven configuration system. I have a discounts table, but want to specify criteria for if a user should get the discount.

For example, if their sign up date is before X date time, allow discount

Another example, if their balance is greater than 1,000 deny all discounts.

Essentially a way to define logical operators / evaluation with reference to other columns

5 Comments
2024/11/28
10:41 UTC

0

DBs and users randomly gone...

Hi everyone,

I've got an issue that's driving me nuts...

Randomly, MySQL DBs and files are gone...the web server files are there, but no DB anymore.

I only got default DBs with SHOW DATABASES; and /var/lib/mysql doesn't have any folders related to my usual DBs.

I can rollback to a previous backup but I want to know what's going on and can't seem to figure it out...

Has anyone had this issue already?

Thank a lot!

6 Comments
2024/11/28
10:14 UTC

0

I need help learning MySQL

I need to learn MySQL for work. Can yall recommend the best way to learn in the shortest amount of time?

10 Comments
2024/11/28
04:37 UTC

0

Link uug

To join the meeting on Google Meet, click this link: https://meet.google.com/rxe-vshp-qzi

Or open Meet and enter this code: rxe-vshp-qzi

0 Comments
2024/11/27
13:12 UTC

1

does mysql work for win 10 32 bit?

i have tired everything but the launcher says no packages found, i tried deleting all sql files and uninstalling laucncher then restarted pc and tried again 3 times still dosnt work , someone please help

2 Comments
2024/11/27
11:10 UTC

1

JSON to mysql

How to import my JSON file data in MySQL database, JSON file is around 3.9Gb please help me

7 Comments
2024/11/26
06:40 UTC

1

MySQL Workbench EER-Diagram resolution error

Hello,

Just starting out using MySQL - recently I've tried using Reverse Engineer method to show EER-Diagram of my work.

The result is the diagram map but I cant see the whole map because it opens in a very little window.

Can figure out how to expand it.

Have you came across such thing ?

1 Comment
2024/11/26
06:34 UTC

1

tuning-primer.sh says I've not enabled InnoDB support, but how?

tuning-primer.sh says I've not enabled InnoDB support

No InnoDB Support Enabled!

But when I run 'show engines" command in mysql, the, InnoDB is default engine (see below)

Can someone explain this? Do I have to make another step to enable InnoDB? Thank you

I have Rocky Linux 9.4 and MySQL 8.4.3 LTS

mysql> show engines
    -> ;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| ndbcluster         | NO      | Clustered, fault-tolerant tables                               | NULL         | NULL | NULL       |
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| ndbinfo            | NO      | MySQL Cluster system information storage engine                | NULL         | NULL | NULL       |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
11 rows in set (0.00 sec)
2 Comments
2024/11/25
21:31 UTC

1

Question about use cases

Hey guys, I have a fairly cursory understanding of mysql but I am stuck in the question of is it worth it. I work for a nonprofit, and we currently use a software to track all of our information, forms, etc. However it is painfully outdated, is hard to navigate, and requires a lot of work on my end to train any new people on the database. I have written a bunch of scripts to pull information already as the software has some (minimal) api's and that makes everyones life much easier.

However, as a project I thought of the idea to just compile everything into a RDBMS and then pull my information from there. It would be easier for me to source everything from there while I have the information. Do you think that this would be a worthwhile project, or is a case of making things harder on myself. Any help or recommendations is appreciated!

7 Comments
2024/11/25
20:20 UTC

0

Finding databases?

I hope this is the right place to ask... is there a typical way to find any/all databases on a computer (Windows PC)? I've tried SHOW DATABASES; but that seems to only bring up any that are in the mysql subdirectory. And, I don't know how to get mysql into the root dir so that it would look for databases through the whole drive. I hope this is making sense.

10 Comments
2024/11/25
03:58 UTC

1

MySQL workbench unexpectedly closing on Mac M1 after recent update

Whenever I click to any MySQL connection, the application just closes and a prompt appears that MySQL workbench quits unexpectedly. Please help, I’ve tried uninstalling and reinstalling different versions but no help

1 Comment
2024/11/24
16:38 UTC

1

How to connect to someone's mysql database with mariadb?

I am using Arch Linux and can't use mysql so I am using mariadb. My group is making a semester project with java and want to connect to a mysql database. We cannot figure how to make the database available to use for all members.

I will appreciate any help!

2 Comments
2024/11/24
15:15 UTC

0

Is it possible every user registration, will create individual table for itself, inside the main table

I already have a table for the users registration, What I want to achieve is every user that will register will create table for itself inside the users registration table. Is it possible ? in sql my phpadmin

9 Comments
2024/11/24
07:36 UTC

1

mysql docker crashed, seems unable to start, ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Hi I'm running mysql in docker on Unraid, using the standard library/mysql container.

I noticed that mysql is inaccessible, the container is stuck pegging one CPU (assigned 8) and using 54MB memory (Assigned 8GB).

I need help.

I have tried to connect to it, but I keep receiving the error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

my config at /etc/my.cnf

bash-5.1# cat /etc/my.cnf
# For advice on how to change settings please see
# 

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M

host-cache-size=0
skip-name-resolve
datadir=/var/lib/mysql
socket=/var/run/mysqld/mysqld.sock
secure-file-priv=/var/lib/mysql-files
user=mysql

pid-file=/var/run/mysqld/mysqld.pid
[client]
socket=/var/run/mysqld/mysqld.sock

!includedir /etc/mysql/conf.d/http://dev.mysql.com/doc/refman/9.1/en/server-configuration-defaults.html

I can access the container, and query it, but I cannot get connected to mysql, it seems stuck to start.
Here are some responses I've received when querying from outseide the container:

root@server:~# ps aux | grep mysql
root     30458  0.0  0.0   4052  2080 pts/1    S+   00:27   0:00 grep mysql
root     32760 99.9  0.0 704000  1160 ?        Rsl  Nov23  57:01 gosu mysql /usr/local/bin/docker-entrypoint.sh mysqld --mysql-native-password=ON

root@server:~# docker exec -i mysql sh -c 'exec mysql -uroot "$MYSQL_ROOT_PASSWORD"'
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

root@server:~# docker exec mysql sh -c 'exec mysqldump --all-databases -uroot -p"$MYSQL_ROOT_PASSWORD"' > /mnt/user/backups/all-databases.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) when trying to connect

Here I go into the container to investigate:

root@server:~# docker exec -it mysql bash
bash-5.1# mysql -u root -p"$MYSQL_ROOT_PASSWORD" -h 
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1:3306' (111)

bash-5.1# cat /var/log/mysqld.log 

bash-5.1# ls -lah /var/run/mysqld/
total 0
drwxrwxrwt 1 mysql mysql  0 Sep 24 14:52 .
drwxr-xr-x 1 root  root  56 Nov 22 00:09 ..

bash-5.1# ls -lah /var/lib/mysql/ 
total 507M
-rw-rw-rw- 1 mysql users 6.0M Nov 13 07:56 '#ib_16384_0.dblwr'
-rw-rw-rw- 1 mysql users  14M Sep 20 16:39 '#ib_16384_1.dblwr'
drwxrwxrwx 1 mysql users 4.0K Nov 13 08:08 '#innodb_redo'
drwxrwxrwx 1 mysql users    6 Nov 13 08:08 '#innodb_temp'
drwxrwxrwx 1 mysql users 4.0K Nov 23 23:30  .
drwxr-xr-x 1 root  root   166 Nov 22 00:09  ..
-rw-rw-rw- 1 mysql users   56 Nov 12 08:07  auto.cnf
-rw-rw-rw- 1 mysql users  40M Oct 15 12:28  binlog.000738
-rw-rw-rw- 1 mysql users 9.7M Oct 16 15:31  binlog.000739
-rw-rw-rw- 1 mysql users  14M Oct 18 14:54  binlog.000740
-rw-rw-rw- 1 mysql users 4.7M Oct 19 08:05  binlog.000741
-rw-rw-rw- 1 mysql users 4.6M Oct 20 08:05  binlog.000742
-rw-rw-rw- 1 mysql users  10M Oct 21 08:05  binlog.000743
-rw-rw-rw- 1 mysql users  11M Oct 22 08:05  binlog.000744
-rw-rw-rw- 1 mysql users  12M Oct 23 08:06  binlog.000745
-rw-rw-rw- 1 mysql users 9.1M Oct 24 08:05  binlog.000746
-rw-rw-rw- 1 mysql users 7.8M Oct 25 08:05  binlog.000747
-rw-rw-rw- 1 mysql users 5.9M Oct 26 08:05  binlog.000748
-rw-rw-rw- 1 mysql users  12M Oct 27 08:06  binlog.000749
-rw-rw-rw- 1 mysql users 9.1M Oct 28 08:05  binlog.000750
-rw-rw-rw- 1 mysql users 7.2M Oct 29 08:05  binlog.000751
-rw-rw-rw- 1 mysql users 7.5M Oct 30 08:05  binlog.000752
-rw-rw-rw- 1 mysql users 8.0M Oct 31 08:05  binlog.000753
-rw-rw-rw- 1 mysql users 7.9M Nov  1 08:07  binlog.000754
-rw-rw-rw- 1 mysql users 6.2M Nov  2 08:08  binlog.000755
-rw-rw-rw- 1 mysql users 5.9M Nov  3 08:07  binlog.000756
-rw-rw-rw- 1 mysql users 5.7M Nov  4 08:07  binlog.000757
-rw-rw-rw- 1 mysql users 7.2M Nov  5 08:07  binlog.000758
-rw-rw-rw- 1 mysql users 6.9M Nov  6 08:07  binlog.000759
-rw-rw-rw- 1 mysql users  11M Nov  7 08:07  binlog.000760
-rw-rw-rw- 1 mysql users 7.5M Nov  8 08:07  binlog.000761
-rw-rw-rw- 1 mysql users 5.9M Nov  9 08:08  binlog.000762
-rw-rw-rw- 1 mysql users 7.6M Nov 10 08:06  binlog.000763
-rw-rw-rw- 1 mysql users 9.4M Nov 11 08:07  binlog.000764
-rw-rw-rw- 1 mysql users 8.1M Nov 12 08:07  binlog.000765
-rw-rw-rw- 1 mysql users 7.3M Nov 13 08:08  binlog.000766
-rw-rw-rw- 1 mysql users 8.1M Nov 14 08:07  binlog.000767
-rw-rw-rw- 1 mysql users  14M Nov 15 08:08  binlog.000768
-rw-rw-rw- 1 mysql users 7.3M Nov 16 08:08  binlog.000769
-rw-rw-rw- 1 mysql users 6.9M Nov 17 08:07  binlog.000770
-rw-rw-rw- 1 mysql users 6.3M Nov 18 08:08  binlog.000771
-rw-rw-rw- 1 mysql users 9.9M Nov 19 08:08  binlog.000772
-rw-rw-rw- 1 mysql users  15M Nov 20 08:07  binlog.000773
-rw-rw-rw- 1 mysql users  464 Nov 12 08:07  binlog.index
drwxrwxrwx 1 mysql users    6 Jun  8  2020  servermysql
-rw-rw-rw- 1 mysql users 1.7K Jun  8  2020  ca-key.pem
-rw-rw-rw- 1 mysql users 1.1K Jun  8  2020  ca.pem
-rw-rw-rw- 1 mysql users 1.1K Jun  8  2020  client-cert.pem
-rw-rw-rw- 1 mysql users 1.7K Jun  8  2020  client-key.pem
-rw-rw-rw- 1 mysql users 6.4K Nov 13 08:08  ib_buffer_pool
-rw-rw-rw- 1 mysql users  12M Nov 13 08:08  ibdata1
drwxrwxrwx 1 mysql users  145 Sep 20 16:39  mysql
-rw-rw-rw- 1 mysql users  84M Nov 13 07:54  mysql.ibd
lrwxrwxrwx 1 mysql users   27 Nov 12 08:07  mysql.sock -> /var/run/mysqld/mysqld.sock
-rw-rw-rw- 1 mysql users  252 Sep 20 16:39  mysql_upgrade_history
drwxrwxrwx 1 mysql users 8.0K Feb  4  2024  nextcloud_db
drwxrwxrwx 1 mysql users 8.0K Jul  5 03:12  performance_schema
drwxrwxrwx 1 mysql users    6 Dec 24  2021  db1
drwxrwxrwx 1 mysql users 4.0K Jun  2  2022  db2
-rw-rw-rw- 1 mysql users 1.7K Jun  8  2020  private_key.pem
-rw-rw-rw- 1 mysql users  452 Jun  8  2020  public_key.pem
-rw-rw-rw- 1 mysql users 1.1K Jun  8  2020  server-cert.pem
-rw-rw-rw- 1 mysql users 1.7K Jun  8  2020  server-key.pem
drwxrwxrwx 1 mysql users   28 Jun  8  2020  sys
-rw-rw-rw- 1 mysql users  30M Nov 13 07:56  undo_001
-rw-rw-rw- 1 mysql users  30M Nov 13 07:56  undo_002
drwxrwxrwx 1 mysql users 4.0K Feb  5  2023  wordpress_db

bash-5.1# exit
exit127.0.0.1

I'm very stuck at the moment, not sure what to try anymore.

The log at /var/log/mysqld.log is empty, not sure what to do.

Can anyone help?

12 Comments
2024/11/23
23:42 UTC

0

Can someone help me with an installation error?

The problem is that I installed several times and I have a server error.

2 Comments
2024/11/23
01:47 UTC

4

Where do I go for academic help?

Hello, so I'm sorry if this is a dumb question, but working on an assignment, and it's a nightmare for me. I've tried everything at this point. I've looked up stuff on my notes, tried Microsoft Copilot, and read posts on Stack Overflow. I still haven't had any success.

I've even asked help from my professor and he wasn't really much help. He's a good professor, but I guess we just couldn't get it to work for some reason.

I'm still searching the web for help, but still no success. Are there any other good resources for help on MySQL for academic work?

9 Comments
2024/11/22
06:32 UTC

2

Getting the first record in a group by

I just failed a coding interview, and am hoping someone can help me understand what I couldn't. I tried googling this, but couldn't find an answer. I found stuff for SQL and other languages, but nothing for MySQL. I'm sure it's my google-fu, so I'd appreciate any help, or direction on where I can go to get more help.

I was given two tables: movies (id (int), title, genre) and reviews (movie_id, rating (int between 1 and 5)). I was tasked with writing a query that would return the max rated movie in each genre. I can't remember the exact code I wrote but it was close to this:

WITH average_ratings AS (
	SELECT m.id, m.title, m.genre, AVG(r.rating) average_rating
	FROM movies m
	INNER JOIN reviews r ON m.id = r.movie_id
	GROUP BY m.id
)
SELECT gm.genre, FLOOR(gm.max_rating) FROM (
	SELECT genre, MAX(average_rating) max_rating
	FROM average_ratings
	GROUP BY genre
) gm
ORDER BY gm.genre

This gave me back the highest average ranking for each genre, but I couldn't find a way to join movies back on to get the movie title of each. I tried

INNER JOIN average_ratings ar ON gm.max_rating = ar.average_rating

But I got back the same row multiple times. I tried LEFT JOIN, because that should only return one row per gm row, and I still got back multiples. I even recreated the database locally and tested, and the code above (with inner and left) works. I'm positive the code I wrote in the test was functionally the same, so I can't tell if this is a version difference, there's a "gotcha" I'm missing, or something else. It's driving me insane and 8 months of no job is really demoralzing me. I'd love any feedback.

Also, ChatGPT sucks. I started by getting help there, took me 20 minute to get a response that uses ROW_NUMBER, which I'm trying to understand, but doesn't yet make sense to me.

3 Comments
2024/11/21
23:03 UTC

Back To Top