Category: MySQL

Lost MySQL Root User, Create Root User skip-grant-tables:

1. Log in via SSH
2. Open /etc/my.cnf
3. add the following under the mysqld group

skip-grant-tables

4. Restart MySQL and now you can login as any user with full permissions
5. Go to mysql database and add a root user with permissions manually, set all priv fields to Y

For MySQL 4

INSERT INTO user VALUES('localhost','root',PASSWORD('PASSWORD'),'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);

1. Remove the skip-grant-tables
2. Restart MySQL and now you can login with your root user

 

Tags:

mySQL

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.