mysql 设置、更改、找回密码

1,新装mysql,添加密码

mysqladmin -u root password NEWPASSWORD

2,记得旧密码,改密码

mysqladmin -u root -p'OLDPASSWORD' password NEWPASSWORD

3,不记得旧密码,新设密码

  1. Stop the MySQL server process with the command: sudo service mysql stop
  2. Start the MySQL server with the command: sudo mysqld_safe —skip-grant-tables —skip-networking &
  3. Connect to the MySQL server as the root user with the command: mysql -u root

At this point, you need to issue the following MySQL commands to reset the root password:

mysql> use mysql;
​mysql> update user set authentication_string=password('NEWPASSWORD') where user='root';
​mysql> flush privileges;
​mysql> quit
posted @ 2018-04-16 00:56  名白  阅读(208)  评论(0编辑  收藏  举报