简体   繁体   English

更新5.6的MySQL密码?

[英]Updating MySQL passwords for 5.6?

A bit confused on this one. 对此有些困惑。

Just about to upgrade MySQL from 5.5 to 5.6 即将将MySQL从5.5升级到5.6

There is a warning that many of the databases use old passords. 有警告,许多数据库使用旧密码。

The following users use pre-4.1-style MySQL passwords: 以下用户使用4.1之前版本的MySQL密码:

We recommend that you update all of your accounts to longer MySQL password hashes before you perform this upgrade. 我们建议您在执行此升级之前,将所有帐户更新为更长的MySQL密码哈希。 Failure to do so could disrupt database access for accounts or applications that use pre-4.1-style MySQL passwords. 否则可能会破坏使用4.1之前版本的MySQL密码的帐户或应用程序的数据库访问权限。

I am not 100% sure what I need to do if anything. 我不确定100%是否需要做些什么。

Many of the accounts are not even databases. 许多帐户甚至都不是数据库。

I have tried to do a google search and not found anything helpful. 我试图做一个谷歌搜索,没有发现任何帮助。

There is an option on cPanel to use pre 4.1 passwords, but that is not enabled, so not sure why this should flag up now, as I would expect issues, if I was using old passwords (whatever they might be). cPanel上有一个选项可以使用4.1之前的密码,但是没有启用,因此不确定如果我使用旧密码(无论使用哪种密码),为什么现在应该将其标记出来,因为我希望出现问题。 That option goes away with 5.6 anyway. 无论如何,该选项不再适用5.6。

Can anyone assist or give guidance. 任何人都可以协助或提供指导。

Thanks. 谢谢。

Execute below statement on your db- 在您的数据库上执行以下语句

SELECT USER,PASSWORD FROM mysql.user LIMIT 1;

If you are getting password length less than 41 suppose approx 16 it means you are using old password format and you need to change it to in new format which is of 41 length and more secure. 如果您获得的密码长度小于41,假设大约为16,则意味着您使用的是旧密码格式,因此需要将其更改为41长度且更安全的新格式。

You can change your password format by below command- 您可以通过以下命令更改密码格式:

set password for 'user'@'ip' = password ('new password');

Note: Before this you need to keep privileges tables backup. 注意:在此之前,您需要保留特权表备份。 Also need to comment old_password option in your configuration file if it is on. 如果已打开,还需要在配置文件中注释old_password选项。

 For Windows, do this:

shell> mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'::1' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd');

The last statement is unnecessary if the mysql.user table has no root account with a host value of %.

For Unix, do this:

shell> mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'::1' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');

You can also use a single statement that assigns a password to all root accounts by using UPDATE to modify the mysql.user table directly. This method works on any platform:

shell> mysql -u root
mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
    ->     WHERE User = 'root';
mysql> FLUSH PRIVILEGES;

Take Reference from this link :- 从此链接获取参考:

http://dev.mysql.com/doc/refman/5.6/en/default-privileges.html http://dev.mysql.com/doc/refman/5.6/en/default-privileges.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM