vendredi 31 juillet 2015

Locked out of MySQL Database

I am working on a MySQL database that I eventually plan to add an API to. Today, I had a random problem with my regular (non-root) account. When I tried to login through PHPMyAdmin, it said Cannot log in to the MySQL server. So I tried to log in from the command line using mysql -umkaryadi -p and entered my password. I got back Access denied for user 'mkaryadi'@'localhost' (using password: YES). No big deal, I thought, so I logged into PHPMyAdmin and deleted and recreated my mkaryadi account.

Later, I was trying to login to with PHPMyAdmin with my root account and got the same Cannot log in to the MySQL server error. I tried to run mysqld_safe --skip-grant-tables and that let me log in. Then, I attempted to run UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; but I got an error to the effect that it couldn't find the Password column in the user table. I had read that you needed to run FLUSH PRIVILEGES; so I tried that before trying to change the password and got: You are logged in as an anonymous user, and anonymous users can't change passwords.

At this point, I tried to back up the databases with mysqldump but now that yields mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect. Now, mysqld_safe --skip-grant-tables doesn't even let me login. I'm not entirely sure what to do here, I've reinstalled MySQL already.

Any help would be appreciated.

Computer: MacBook (13-inch, Aluminum, Late 2008) running OS X 10.10.2

MySQL version: 5.5.45

EDIT: I talked with @SteJ here and still have problems. I am still getting the The server quit without updating PID file error, but have done a fresh install of MySQL.

Aucun commentaire:

Enregistrer un commentaire