Lấy lại password cho mysql ?

Số là em quên mất pass của mysqlserver nên không đăng nhập được phpmyadmin. khi gõ lệnh "mysql -u root" thì nó lại báo là "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)" . Ai có cách nào chỉ em với. Em đang cần gấp lắm. Thanks nhìu lắm

thuy linh
thuy linh
Trả lời 13 năm trước

Thử cái này coi sao. Mình search thấy chứ chưa thử

1. Stop the mysqld daemon process.
2. Start the mysqld daemon process with the --skip-grant-tables option.
3. Start the mysql client with the -u root option.
4. Execute the UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
5. Execute the FLUSH PRIVILEGES; command.