微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

修改mysql数据库密码简析

下文内容主要给大家带来修改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数据库密码简析,如果大家还有更多需要了解的可以持续关注我们编程之家的行业推新,如需获取专业解答,可在官网联系售前售后的,希望该文章可给大家带来一定的知识更新。

 

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐