Solved [Solved] Cannot access MySQL

Hello everyone,

I wonder if someone could help me here.

For some reason, I am no longer able to login to MySQLdatabase on my jail.
Here is the error message:
Code:
root@sqljail:/ # mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
I tried to reset the password using the following:
/usr/local/etc/rc.d/mysql-server stop
Code:
vi ~/reset.sql
UPDATE mysql.user SET Password=PASSWORD('MYPASSWORD') WHERE User='root';
FLUSH PRIVILEGES;
mysqld_safe --init-file=~/reset.sql &

Code:
vi ~/localhost.sql
GRANT ALL PRIVILEGES ON *.* TO 'sqldbadmin'@'localhost' IDENTIFIED BY 'MYPASSWORD' WITH GRANT OPTION;
FLUSH PRIVILEGES;
mysqld_safe --init-file=~/reset.sql &

But the error message is still the same.
Could anyone help please
 
Re: Cannot access MySQL

Just realized that all my sites are down as well but when I check status of MySQL, it say that it is running
Code:
root@sqljail:/ # /usr/local/etc/rc.d/mysql-server status
mysql is running as pid 5701.

I do have a backup of the jail if anyone could tell me what file to overwrite
 
fred974 said:
mysqld_safe --init-file=~/reset.sql &
Instead of this you should be able to do /usr/local/etc/rc.d/mysql-server start --skip-grant-tables.
MySQL will then start but won't read the GRANT tables. You can then easily change root's password with mysqladmin -u root password NEWPASSWORD. Once the root password is set, restart MySQL to load the GRANT tables normally. You should now be able to login again.
 
Back
Top