这个问题最开始查资料都说要改密码,密码不对。其实不是这个样子都。

解决方法

  1. 修改/etc/mysql/my.cnf,添加以下内容
    [mysqld]
    skip-grant-tables
  2. 重启mysql服务/etc/init.d/mysql restart
  3. 使用mysql -u root连接
  4. 执行select user, plugin from mysql.user;

    若显示以下结果,请继续;若没有,这篇文章解决不了。
+------------------+-----------------------+
| user | plugin |
+------------------+-----------------------+
| root | auth_socket |
+------------------+-----------------------+
  1. 执行update mysql.user set authentication_string=PASSWORD('pass'),plugin='mysql_native_password' where user='root';将root都密码修改为pass
  2. 执行flush privileges;刷新一下
  3. 移除第一步添加的内容;重复第二步

修改过后user表就变这样了

+------------------+-----------------------+
| user | plugin |
+------------------+-----------------------+
| root | mysql_native_password |
+------------------+-----------------------+

MySQL使用普通用户访问返回ERROR 1698 (28000): Access denied for user 'root'@'localhost'的更多相关文章

  1. Ubuntu下使用mysqli-connect连接mysql时报错:ERROR 1698 (28000): Access denied for user 'root'@'localhost'

    LNMP安装好后,写了个index.php文件,里面的内容很简单,就是想测试php与mysql的通信是否正常,代码如下: <?php $host = 'localhost'; $user = ' ...

  2. mysql安装以后无法登陆的的解决方法((ERROR 1698 (28000): Access denied for user 'root'@'localhost'))

    mysql安装以后无法登陆的的解决方法((ERROR 1698 (28000): Access denied for user 'root'@'localhost')) 解决步骤: [====> ...

  3. Ubuntu16.04 ERROR 1698 (28000): Access denied for user 'root'@'localhost' 解决流程

    mysql版本 5.7.22 安装完成后出现问题 ERROR 1698 (28000): Access denied for user 'root'@'localhost' 可能是因为初始密码为空:按 ...

  4. ERROR 1698 (28000): Access denied for user 'root'@'localhost' 解决方法

    之前MySQL服务端本机上使用密码登陆root账号是没有问题的,但是今天不知道是因为动了哪里,登陆失败并有这个错误代码: ~$ mysql -u root -p Enter password: ERR ...

  5. mysql安装在centos7报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    原文链接:http://blog.csdn.net/kuluzs/article/details/51924086 [问题]:mysql版本:5.7.13 首次在centos下安装MySQL,客户端连 ...

  6. ERROR 1698 (28000): Access denied for user 'root'@'localhost'

    Some systems like Ubuntu, mysql is using by default the UNIX auth_socket plugin. Basically means tha ...

  7. ubuntu下 mysql安装以后无法登陆的的解决方法((ERROR 1698 (28000): Access denied for user 'root'@'localhost'))

    1. 删除mysql sudo apt-get autoremove --purge mysql-server-5.0 sudo apt-get remove mysql-server sudo ap ...

  8. MySQL ERROR 1698 (28000): Access denied for user 'root'@'localhost'

    今天在安装MySQL的过程中竟然没有让我输入密码,登录的时候也不需要密码就能进入,这让我很困惑. 进了数据库就设置密码,用了各种方式都不行. 虽然我这数据库没啥东西但也不能没有密码就裸奔啊,有点丢人是 ...

  9. mac系统中搭建apache+mysql+php的开发环境,安装mysql后,登录报错:mac ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    php新手在mac系统中搭建apache+mysql+php的开发环境(按照这篇博客来操作的:http://my.oschina.net/joanfen/blog/171109?fromerr=xvC ...

随机推荐

  1. [转帖]Docker的数据管理(volume/bind mount/tmpfs)

    Docker(十五)-Docker的数据管理(volume/bind mount/tmpfs) https://www.cnblogs.com/zhuochong/p/10069719.html do ...

  2. 1363. ZigZag Conversion

    public class Solution { /** * @param s: the given string * @param numRows: the number of rows * @ret ...

  3. MySQL 字段内容区分大小写

    数据由Oracle 迁入MySQL ,由于之前Oracle区分大小写,MySQL的配置使用了默认配置,导致一些数据导入失败,有的唯一键报错,冲突. 将测试过程记录在下面. 数据库版本:MySQL 5. ...

  4. StatefulSet

    StatefulSet: 1.稳点且唯一的网络标识符 2.稳点且持久的存储 3.有序.平滑的部署和扩展 4.有序.平滑的删除和终止 5.有序的滚动更新 三个组件组成:headless(无头服务)    ...

  5. Zend Framework2从入门到精通

    1. 下载安装zf2的web程序 步骤: 第一步,保证得到一个基本的zf2框架 直接从官网下载并解压即可:http://www.zendframework.org.cn/downloads/lates ...

  6. volatile和synchronized的区别

    volatile和synchronized特点 首先需要理解线程安全的两个方面:执行控制和内存可见. 执行控制的目的是控制代码执行(顺序)及是否可以并发执行. 内存可见控制的是线程执行结果在内存中对其 ...

  7. Bootstrap之图片展示界面Demo

    代码:(使用模板引擎freemarker) <!DOCTYPE html> <html> <head> <title>图片</title> ...

  8. C#里XML(JSON)序列化时,自动隐藏值为Null的成员的输出

    从StackOverflow里找到的答案.发现对最新的Newtownsoft的JSON序列化也同样适用. https://stackoverflow.com/questions/5818513/xml ...

  9. windows下ping端口

    上图的操作完成以后  进入dos控制台 输入telnet  ip地址  端口号   回车 标识已ping通 ping不通是这种提示

  10. 【python练习题】程序17

    #题目:输入一行字符,分别统计出其中英文字母.空格.数字和其它字符的个数. s = input('请输入字符串:') alf = 0 space = 0 digi = 0 other = 0 for ...