How do I find out my root MySQL password?

前端 未结 11 1963
不知归路
不知归路 2020-12-22 17:39

I just installed MySQL on Ubuntu and the root user can\'t log in :)

How can I recover or find out my password? Using blank for password does not work.

11条回答
  •  执念已碎
    2020-12-22 17:59

    Hmm Mysql 5.7.13 to reset all I did was:

    $ sudo service mysql stop To stop mysql

    $ mysqld_safe --skip-grant-tables & Start mysql

    $ mysql -u root

    Just like the correct answer. Then all I did was do what @eebbesen did.

    mysql> SET PASSWORD FOR root@'localhost' = PASSWORD('NEW-password-HERE');

    Hope it helps anyone out there :)

提交回复
热议问题