/r/mysql
Discussion of MySQL and assistance for MySQL related questions
New Sidebar coming soon.
/r/mysql
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?
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:
brew install mysql
).--skip-grant-tables
, but I’m still facing issues.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!
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.
the title, why is Xampp SO FUCKING SLOW
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:
Foreign-key Constraints:
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);
});
});
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?
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?
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
The Employee table has the following columns:
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
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.
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/
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.
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
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!
I need to learn MySQL for work. Can yall recommend the best way to learn in the shortest amount of time?
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
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
How to import my JSON file data in MySQL database, JSON file is around 3.9Gb please help me
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 ?
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)
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!
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.
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
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!
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
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?
The problem is that I installed several times and I have a server error.
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?
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.