Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How To Recover Your MySQL root Password
- in 6 easy steps:
- Step 1: Stop the mysql service
- # /etc/init.d/mysql stop
- Expected Output:
- Stopping MySQL database server: mysqld.
- Step 2: Start the MySQL server without password
- # mysqld_safe --skip-grant-tables &
- Expected Output:
- [1] 5988
- Starting mysqld daemon with databases from /var/lib/mysql
- mysqld_safe[6025]: started
- Step 3: Connect to your MySQL server using the MySQL client
- # mysql -u root
- Expected 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>
- Step 4: Setup a new MySQL password for the root user
- mysql> use mysql;
- mysql> update user set password=PASSWORD("YOUR-NEW-PASSWORD") where User='root';
- mysql> flush privileges;
- mysql> quit;
- Expected Output:
- Database changed
- Query OK, 0 rows affected (0.00 sec)
- Rows matched: 1 Changed: 0 Warnings: 0
- Query OK, 0 rows affected (0.00 sec)
- Bye
- Step 5: Stop the MySQL Server
- # /etc/init.d/mysql stop
- Expected Output:
- Stopping MySQL database server: mysqld
- STOPPING server from pid file /var/run/mysqld/mysqld.pid
- mysqld_safe[6186]: ended
- [1]+ Done mysqld_safe --skip-grant-tables
- Step 6: Start the MySQL server and test it
- # /etc/init.d/mysql start
- # mysql -u root -p
- Expected Output:
- Starting service MySQL done
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is xx
- Server version: x.x.xx XXXXX MySQL RPM
- Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
- mysql>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement