Reputation: 25
MySQL was working fine yesterday but today when I tried connecting to MySQL with Python, I recieved this error. I tried to open MySQL Command Line but it closes right after I input the password even though MySQL service is running. So I can't run any MySQL queries through the command line.
I am definitely sure the password for the root account is correct, but I tried leaving the password and the user blank but it still gives the same error. I tried to change the password through the Installer, but whenever I try to configure the password it asks me for my old password, when I enter it this error shows up:
Hovering over the X the error states
MySQL Server is not running, a connection cannot be established.
As I said before, MySQL service is actually running. I am unable to change the password through cmd as well, through
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqladmin -uroot -p password
Enter password: *****
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
I have tried using the password blank as well as the user blank in all of these as well. Port is 3306. Any help would be appreciated. Thanks in advance.
EDIT: The Python code I used to connect was:
qtdb = mysql.connector.connect(host = "localhost", user = "root",
password = "mysql", database = "misc", port = "3306")
Upvotes: 0
Views: 7219
Reputation: 25
Ok, so I figured it out. I used this guide to change my password:
https://dev.mysql.com/doc/mysql-windows-excerpt/5.7/en/resetting-permissions-windows.html
Upvotes: 1