Access denied for user (using password:YES) 解决方案

正文开始

 解决方案:<br />1、打开MySQL目录下的my.ini文件,在文件的最后添加一行“skip-grant-tables”,保存并关闭文件。<br />2、重启MySQL服务。<br />3、在命令行中输入“mysql -uroot -p”(不输入密码),回车即可进入数据库。<br />4、执行,“use mysql;”使用mysql数据库。<br /><p>5、执行,update mysql.user set authentication_string=password('xxxxxxx') where user='root' ;</p><p>(修改root的密码)</p>(期间我还select下user表中的记录,查询全部的时候显示了一些乱码,然后我只查询了user表中的Host、User、Password字段,貌似当时显示了3条记录,有1个没有名称。当然,为了解决问题,这些我也管不了了。)<br />6、打开MySQL目录下的my.ini文件,删除最后一行的“skip-grant-tables”,保存并关闭文件。<br /><p>7、重启MySQL服务。</p><p><br /></p><p>新安装的MySQL5.7,登录时提示密码错误,安装的时候并没有更改密码,后来通过免密码登录的方式更改密码,输入update mysql.user  set password=password('root') where user='root'时提示ERROR 1054 (42S22): Unknown column 'password' in 'field list',原来是mysql数据库下已经没有password这个字段了,password字段改成了</p><pre id="recommend-content-2372196192" style="margin-top:0px; margin-bottom:10px; padding:0px; font-family:arial,'courier new',courier,宋体,monospace,'Microsoft YaHei'; white-space:pre-wrap; word-wrap:break-word; font-size:14px; color:rgb(51,51,51); line-height:24px; background-color:rgb(243,255,236)" name="code">authentication_string</pre><p></p><p style="margin-top:0px; margin-bottom:10px; padding:0px; font-family:arial,'courier new',courier,宋体,monospace,'Microsoft YaHei'; white-space:pre-wrap; word-wrap:break-word; font-size:14px; color:rgb(51,51,51); line-height:24px; background-color:rgb(243,255,236)">所以更改语句替换为update mysql.user set authentication_string=password('root') where user='root' ;即可</p><br />

正文结束

Mysql Innodb 引擎优化 参数 Centos 7 安装 mysql-5.7.16 (rpm安装)