美文网首页我爱编程
mysql 设置、更改、找回密码

mysql 设置、更改、找回密码

作者: 名白 | 来源:发表于2018-04-16 00:57 被阅读0次

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

相关文章

网友评论

    本文标题:mysql 设置、更改、找回密码

    本文链接:https://www.haomeiwen.com/subject/hyfskftx.html