温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

修改mysql数据库密码简析

发布时间:2020-04-26 13:44:39 来源:亿速云 阅读:351 作者:三月 栏目:系统运维

下文内容主要给大家带来修改mysql数据库密码简析,这里所讲到的知识,与书籍略有不同,都是亿速云专业技术人员在与用户接触过程中,总结出来的,具有一定的经验分享价值,希望给广大读者带来帮助。 

mysql修改数据库密码:
5.7版本数据库在安装时日志中会显示密码
cat /var/log/mysqld.log | grep password

登录时提示修改密码:
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
简单密码不可以设置:

修改mysql数据库密码简析

mysql>  alter user 'root'@'localhost' identified by '123456';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql>

修改数据库密码设置,简单密码也可以用
set global validate_password_policy=0;
set global validate_password_length=1;

设置为简单密码:
alter user 'root'@'localhost' identified by '111111';

密码忘记了:
修改配置文件/etc/my.cnf删除或禁用skip-grant-tables这行。
注:mysql的数据库老版本用参数authentication_string,新版本用参数password
update user set authentication_string=password('123456') where user='root';
update user set password=password('123456') where user='root';
flush privileges; --刷新系统权限表

用工具登录时报错
ERROR 1130: Host 192.168.3.100 is not allowed to connect to this MySQL server

select Host,User from user where user='root';  
update user set host = '%' where user ='root';
flush privileges;

再次登录就可以了

对于以上关于修改mysql数据库密码简析,如果大家还有更多需要了解的可以持续关注我们亿速云的行业推新,如需获取专业解答,可在官网联系售前售后的,希望该文章可给大家带来一定的知识更新。

 

 

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI