I have forgotten username and password for MySQL in LAMP stack on Ubuntu. I want to uninstall and reinstall MySQL for the LAMP server.
Asked
Active
Viewed 434 times
0
-
2Does this answer your question? [How to recover mysql password?](https://askubuntu.com/questions/679556/how-to-recover-mysql-password) – pLumo Apr 17 '20 at 08:50
-
or maybe better this: https://askubuntu.com/questions/118772/how-to-change-root-password-for-mysql-and-phpmyadmin – pLumo Apr 17 '20 at 08:51
1 Answers
1
Create a file (i.e. mysql-reset) containing this line:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');Run MySQL like:
$ mysqld_safe --init-file=/path/to/mysql-reset &
or
$ mysqld -uroot --skip-grant-tables
Simon Sudler
- 3,771
- 3
- 20
- 33
jet
- 7,134
- 1
- 23
- 27