mysql 1698_MySQL-1698 : Access denied for user 'root'@'localhost'解决方法
用root用户连接MySQL 数据库报"ERROR 1698 : Access denied for user ‘root’@‘localhost’" 错误。
**客户端:**terminal,Navicat,连接都该错误报错误.
**系统环境:**ubuntu 18,MySQL5.7
**原因:**The reason is that recent Ubuntu installation (maybe others also), mysql is using by default the UNIX auth_socket plugin.
Basically means that: db_users using it, will be “auth” by the system user credentias. You can see if your root user is set up like this by doing the following: $ sudo mysql -u root # I had to use “sudo” since is new installation
mysql> USE mysql;
mysql> SELECT User, Host, plugin FROM mysql.user;
±-----------------±----------------------+
| User | plugin |
±-----------------±----------------------+
| root | auth_socket |
| mysql.sys | mysql_native_password |
| debian-sys-maint | mysql_native_password
±-----------------±----------------------+
As you can see in the query, the root user is using the auth_socket plugin
There are 2 ways to solve this:
You can set the root user to use the mysql_native_password plugin
You can create a new db_user with you system_user (recommended)
Option 1: $ sudo mysql -u root # I had to use “sudo” since is new installation
mysql> USE mysql;
mysql> UPDATE user SET plugin=‘mysql_native_password’ WHERE User=‘root’;
mysql> FLUSH PRIVILEGES;
mysql> exit;
$ service mysql restart
Option 2: (replace YOUR_SYSTEM_USER with the username you have) $ sudo mysql -u root # I had to use “sudo” since is new installation
mysql> USE mysql;
mysql> CREATE USER ‘YOUR_SYSTEM_USER’@‘localhost’ IDENTIFIED BY ‘’;
mysql> GRANT ALL PRIVILEGES ON . TO ‘YOUR_SYSTEM_USER’@‘localhost’;
mysql> UPDATE user SET plugin=‘auth_socket’ WHERE User=‘YOUR_SYSTEM_USER’;
mysql> FLUSH PRIVILEGES;
mysql> exit;
$ service mysql restart
Remember that if you use option #2 you’ll have to connect to mysql as your system username (mysql -u YOUR_SYSTEM_USER)
Note: On some systems (e.g., Debian stretch) ‘auth_socket’ plugin is called ‘unix_socket’, so the corresponding SQL command should be: UPDATE user SET plugin=‘unix_socket’ WHERE User=‘YOUR_SYSTEM_USER’;
mysql 1698_MySQL-1698 : Access denied for user 'root'@'localhost'解决方法相关推荐
- ERROR 1045 (28000) Access denied for user ‘root‘@‘localhost‘解决方法
事情起源 前天晚上好好的,第二天打开电脑正要开始写垃圾代码时,发现项目启动报错了,看了一下,发现是数据库连不上,我一脸懵逼,只能上csdn搜索大佬的文章,最后解决了问题.下面的过程是本人执行大佬教程时 ...
- mysql ERROR 1045 access denied for user 'root'@'localhost' using
操作系统:WINDOWS7 系统 数据库版本:mysql 5.1 提示:mysql ERROR 1045 access denied for user 'root'@'localhost' usi ...
- MYSQL错误代码#1045 Access denied for user 'root'@'localhost'
http://blog.csdn.net/lykezhan/article/details/70880845 遇到MYSQL"错误代码#1045 Access denied for user ...
- MySql错误1045 Access denied for user 'root'@'localhost' (using password:YES) windows下的解决方案(忘记密码)
MySql错误1045 Access denied for user 'root'@'localhost' (using password:YES) windows下的解决方案(忘记密码) 1.进入管 ...
- Access denied for user 'root'@'localhost' 解决流程
2019独角兽企业重金招聘Python工程师标准>>> ERROR 1698 (28000): Access denied for user 'root'@'localhost' 解 ...
- MySQL安装错误——Access denied for user 'root'@'localhost' (using password: YES)
错误: [root@VM_205_38_centos home]# mysql -u root -p Enter password: ERROR 1045 (28000): Access denied ...
- 解决ubuntu首次安装Mysql之后,首次登录出现ERROR 1698 (28000): Access denied for user 'root'@'localhost'的方法
解决步骤: 1.打开终端,输入sudo vi /etc/mysql/debian.cnf 打开/etc/mysql/debian.cnf文件,显示如下: 2.mysql -udebian-sys-ma ...
- mysql启动提示 access denied for user root@localhost(using password:YES) 解决办法总结
首先计入到mysql的客户端命令行. 然后: mysql>grant all privileges on *.* to 'root'@'localhost' identified by '你的密 ...
- MySql错误1045 Access denied for user 'root'@'localhost' (using password:YES)
1.先停止mysql服务 2.进入mysql的安装路径,找到并打开my.ini文件,找到[mysqld],在该行下面添加 skip_grant_tables,也就是通知mysql,在登陆的时候跳过密码 ...
最新文章
- 重磅!Gartner公布2019年十大战略科技发展趋势
- 【实验】配置802.1x远端认证
- 深入::first-letter的研究
- dj鲜生-26-登陆时-记住用户名的操作
- Java 8 实战学习笔记
- 干货!639页《深度学习:Deep Learning》硬核课程PPT
- MyEclipse6.5安装SVN插件的三种方法
- 比较偏门的JVM语言Quercus - PHP on JVM
- python中rect函数_Rect和RectF函数
- 组成原理之全加器实验
- macd底背离的python_python量化交易是否可以有策略有效识别MACD/SKDJ底背离和顶背离?...
- secureCRT免密安装
- 鸿蒙初开三界未立,太子长琴
- 初探大规模GBDT训练
- air for andriod学习笔记1- 将现有fla文件生成为apk
- UNIX环境高级编程源码
- navicat误删了mysql数据库_navicat for mysql 误删数据库怎么恢复
- #WebStorm激活码失效解决方法!
- MyEclipse使用Maven创建web项目+搭建SSM框架教程
- 2018年小米 Mi air i7-7500u黑苹果efi引导文件