If you forgot your mysql password and you have root access in your linux box, just follow this steps.
1. Stop MYSQL service
# /etc/init.d/mysql stop
or
# service mysqld stop
2. Start MYSQLl without password.
# mysqld_safe –skip-grant-tables &
and the output is:
Output:
[1] 5988
then press enter.
3. Connect to mysql server using MYSQL client.
# mysql -u root
Output:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
4. Create a new MYSQL password.
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
5. Restart MYSQL service
# /etc/init.d/mysql restart
or
# service mysqld restart
No comments:
Post a Comment