centos 7 mysql随机密码_在centos中安装了mysql5.7之后解决不知道随机的密码的问题...
在安裝完成mysql5.7 之后,發(fā)現(xiàn)密碼不知道。不要緊,直接重置密碼。
1.修改配置文件my.cfg
[root@localhost ~]# vi /etc/my.cnf
找到mysqld在之后添加
skip-grant-tables
保存退出
2. 重啟mysql服務(wù)
service ?mysqld ?restart
3.直接登陸mysql而不需要密碼
mysql -u root ? (直接點(diǎn)擊回車)
4.在mysql中輸入
update mysql.user ?set password=password('root') where user='root';
(此時(shí)提示ERROR 1054 (42S22): Unknown column 'password' in 'field list')
5.(這是怎么回事?)原來是mysql數(shù)據(jù)庫下已經(jīng)沒有password這個(gè)字段了,password字段改成了authentication_string
update mysql.user set authentication_string=password('123456') where user='root' ;
6.執(zhí)行flush privileges
7.退出mysql ,到my.cgf中把開始添加的skip-grant-tables去掉
8.重啟mysql服務(wù)
大功告成! 但是事實(shí)并非如此!
9.當(dāng)你登陸mysql之后你會(huì)發(fā)現(xiàn),當(dāng)你執(zhí)行命令時(shí)會(huì)出現(xiàn)
ERROR 1820 (HY000): You must reset your password using ALTER USER statement;
當(dāng)你執(zhí)行了SET PASSWORD = PASSWORD('123456');
出現(xiàn):ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
10.你需要執(zhí)行兩個(gè)參數(shù)來把mysql默認(rèn)的密碼強(qiáng)度的取消了才行
set global validate_password_policy=0;
set global validate_password_mixed_case_count=2;
11這是你在執(zhí)行
SET PASSWORD = PASSWORD('123456');
總結(jié)
以上是生活随笔為你收集整理的centos 7 mysql随机密码_在centos中安装了mysql5.7之后解决不知道随机的密码的问题...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: (centos是linux)
- 下一篇: mac mysql5.7.9 dmg_M