[关闭]
@yangwenbo 2022-07-19T09:57:38.000000Z 字数 1885 阅读 647

MySQL

数据库初始化设置密码时报错"SET PASSWORD has no significance for user 'root'@'localhost' as the authentication method used doesn't store authentication data in the MySQL server."

1、报错示例

  1. Re-enter new password:
  2. ... Failed! Error: SET PASSWORD has no significance for user 'root'@'localhost' as the authentication method used doesn't store authentication data in the MySQL server. Please consider using ALTER USER instead if you want to change authentication parameters.

2、去手动配置密码

  1. root@LNMP:~# mysql
  2. mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'mynewpassword';
  3. Query OK, 0 rows affected (0.02 sec)

3、重新初始化

  1. root@LNMP:~# mysql_secure_installation
  2. Securing the MySQL server deployment.
  3. Enter password for user root:
  4. VALIDATE PASSWORD COMPONENT can be used to test passwords
  5. and improve security. It checks the strength of password
  6. and allows the users to set only those passwords which are
  7. secure enough. Would you like to setup VALIDATE PASSWORD component?
  8. Press y|Y for Yes, any other key for No: n
  9. Using existing password for root.
  10. Change the password for root ? ((Press y|Y for Yes, any other key for No) : n
  11. ... skipping.
  12. By default, a MySQL installation has an anonymous user,
  13. allowing anyone to log into MySQL without having to have
  14. a user account created for them. This is intended only for
  15. testing, and to make the installation go a bit smoother.
  16. You should remove them before moving into a production
  17. environment.
  18. Remove anonymous users? (Press y|Y for Yes, any other key for No) : n
  19. ... skipping.
  20. Normally, root should only be allowed to connect from
  21. 'localhost'. This ensures that someone cannot guess at
  22. the root password from the network.
  23. Disallow root login remotely? (Press y|Y for Yes, any other key for No) :
  24. ... skipping.
  25. By default, MySQL comes with a database named 'test' that
  26. anyone can access. This is also intended only for testing,
  27. and should be removed before moving into a production
  28. environment.
  29. Remove test database and access to it? (Press y|Y for Yes, any other key for No) :
  30. ... skipping.
  31. Reloading the privilege tables will ensure that all changes
  32. made so far will take effect immediately.
  33. Reload privilege tables now? (Press y|Y for Yes, any other key for No) :
  34. ... skipping.
  35. All done!
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注