MySql Error 1698(28000)问题的解决方法
程序员文章站
2023-02-23 16:36:46
一,问题描述:
mysqlerror1698(28000)解决,新装了mysql-server-5.7,登录为这一问题,普通用户不能进mysql,只有root用户才能进,...
一,问题描述:
mysqlerror1698(28000)解决,新装了mysql-server-5.7,登录为这一问题,普通用户不能进mysql,只有root用户才能进,并且不需要任何密码。
~$ mysql -u root -p enter password: error 1698 (28000): access denied for user 'root'@'localhost'
二,解决步骤:
停止mysql服务
~$ sudo service mysql stop
以安全模式启动mysql
~$ sudo mysqld_safe --skip-grant-tables &
mysql启动之后就可以不用密码登陆了
~$ mysql -u root welcome to the mysql monitor. commands end with ; or \g. your mysql connection id is 2 server version: 5.7.10 mysql community server (gpl)
查看一下user表,错误的起因就是在这里, root的plugin被修改成了auth_socket,用密码登陆的plugin应该是mysql_native_password。
mysql> select user, plugin from mysql.user; +-----------+-----------------------+ | user | plugin | +-----------+-----------------------+ | root | auth_socket | | mysql.sys | mysql_native_password | | dev | mysql_native_password | +-----------+-----------------------+ <strong>3</strong> rows in set (<strong>0.01</strong> sec)
关于auth_socket,在官方有说明: ,反正现在暂时不用它, 那就把这里改了。
mysql> update mysql.user set authentication_string=password('newpwd'), plugin='mysql_native_password' where user='root'; query ok, <strong>1</strong> row affected, <strong>1</strong> warning (<strong>0.00</strong> sec) rows matched: <strong>1</strong> changed: <strong>1</strong> warnings: <strong>1</strong> mysql> flush privileges; query ok, <strong>0</strong> rows affected (<strong>0.00</strong> sec)
重启服务,问题就解决了
~$ sudo service mysql stop ... * mysql community server 5.7.10 is stopped ~$ sudo service mysql start .. * mysql community server 5.7.10 is started ~$ mysql -u root -p enter password: welcome to the mysql monitor. commands end with ; or \g. your mysql connection id is 2 server version: 5.7.10 mysql community server (gpl)
以上所述是小编给大家介绍的mysql error 1698(28000)问题的解决方法,希望对大家有所帮助
推荐阅读
-
Mysql CPU占用高的问题解决方法小结
-
MySQL分表自增ID问题的解决方法
-
mysql处理添加外键时提示error 150 问题的解决方法_MySQL
-
MySQL ERROR 1045 (28000) 错误的解决办法
-
解决mysql安装时出现error Nr.1045问题的方法
-
解决MySQL安装重装时出现could not start the service mysql error:0问题的方法
-
MySQL出现SQL Error (2013)连接错误的解决方法
-
mysql处理添加外键时提示error 150 问题的解决方法
-
mysql建库时提示Specified key was too long max key length is 1000 bytes的问题的解决方法
-
mysql 双向同步的键值冲突问题的解决方法分享