0

I have forgotten username and password for MySQL in LAMP stack on Ubuntu. I want to uninstall and reinstall MySQL for the LAMP server.

1
  1. Create a file (i.e. mysql-reset) containing this line:

    SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');
    
  2. Run MySQL like:

    $ mysqld_safe --init-file=/path/to/mysql-reset &
    

or

$ mysqld -uroot --skip-grant-tables
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.