android bsd linux unix & open-source world


How To Reset MySQL Password

WP Greet Box icon
Hello there! If you are new here, you might want to subscribe to the RSS feed or subscribe via E-mail for updates on this topic.

1. Stop MySQL server

# /usr/local/etc/rc.d/mysql-server stop

2. Start MySQL server  with skip grant table mode

# mysqld_safe –skip-grant-tables &
[1] 5187
# Starting mysqld daemon with databases from /var/db/mysql

3. Login as user root without password

# mysql -u root -p

Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.

4. Set up the new root password

mysql> update user set password=password(’newpassword’) where user=’root’;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

5. Stop MySQL server

# /usr/local/etc/rc.d/mysql-server stop

6. Start MySQL server

# /usr/local/etc/rc.d/mysql-server start

Print This Post Print This Post
Comments (0) Trackbacks (0)

No comments yet.

Leave a comment


No trackbacks yet.