เห็น อ. อ๊อด ออก version Windows
สำหรับ Linux Distro อื่น ก็น่าจะใช้ได้เหมือนกัน ต่างกันตรง path
Recovery MySQL root password: MySQL Source distribution on FreeBSD
Step # 1: Stop mysql service:
# /usr/local/share/mysql/mysql.server stop
Output:
Shutting down MySQL... SUCCESS!
Step # 2: Start to MySQL server w/o password:
# mysqld_safe --skip-grant-tables &
Output:
[1] 906
# 080724 17:55:47 mysqld_safe Logging to '/usr/local/var/server-name.err'
080724 17:55:47 mysqld_safe Starting mysqld daemon with databases from /usr/local/var
Step # 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
Server version: 5.1.26-rc-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Step # 4: Setup new MySQL root user password
mysql> use mysql;
mysql> update user set password=password(‘NEW-ROOT-PASSWORD’) where User='root';
mysql> flush privileges;
mysql> \q
Step # 5: Stop MySQL Server:
# /usr/local/share/mysql/mysql.server stop
Output:
Shuttin down MySQL..080724 18:28:45 mysqld_safe mysqld from pid file /usr/local/var/server-name.pid ended
SUCCESS!
[1] + Done mysqld_safe --skip-grant-tables
Step # 6: Start MySQL server and test it
# /usr/local/share/mysql/mysql.server start
# mysql -u root –p
อ้างอิงจาก:
http://www.cyberciti.biz/tips/recover-mysql-root-password.html#comments