Some systems like Ubuntu, 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:

  1. You can set the root user to use the mysql_native_password plugin
  2. 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

ERROR 1698 (28000): Access denied for user 'root'@'localhost'的更多相关文章

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

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

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

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

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

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

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

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

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

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

  6. MySQL使用普通用户访问返回ERROR 1698 (28000): Access denied for user 'root'@'localhost'

    这个问题最开始查资料都说要改密码,密码不对.其实不是这个样子都. 解决方法 修改/etc/mysql/my.cnf,添加以下内容 [mysqld] skip-grant-tables 重启mysql服 ...

  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. Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    案例环境: 操作系统 :Red Hat Enterprise Linux Server release 5.7 (Tikanga) 64 bit 数据库版本 : Mysql 5.6.19 64 bit ...

  9. MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)的真正原因

    在博客Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N ...

随机推荐

  1. Python编码规范:IF中的多行条件

    Python编码规范:IF中的多行条件 转载 2017年03月08日 09:40:45 http://blog.csdn.net/wsc449/article/details/60866700 有时我 ...

  2. easyui commobox省市区县三级联动

    1.前端代码 <div class="col-6 f-group"> <label class="col-4 left_red"> 省名 ...

  3. js估算一篇文章的阅读时长

    每天早上上班在地铁里我都有看技术类文章以及实时新闻的习惯,偶尔会看到有些文章的开始部分会提醒我们这篇文章大概的阅读时长,我就在想这是怎么实现的,具体到前端开发中,又是如何实现的.今天在浏览Segmen ...

  4. 运用了css,js

    代码如下: <!DOCTYPE html><html xmlns="http://www.w3.org/1999/html"><head> &l ...

  5. connect socket的超时设置

    最近项目中,有个需求是检测某ip地址是否是通的,使用了socket的connect函数.但是,当ip地址写错的话,connect就会一直阻塞在那里,大概2.3分钟才能返回连接失败.这对于用户来说是不可 ...

  6. 在多个平台如何安装Python

    最近的一个项目,架构师米洛需要用的mqtt,服务器开发的时候,竟然用的python脚本.运行python就需要安装开发环境,好吧,百度一下就知道了大神廖雪峰.以下部分测试通过,转载记录如下. 因为Py ...

  7. hue,kylin,ambari

    apache-kylin https://ambari.apache.org/ https://www.jianshu.com/p/c49c61b654da docker pull sequencei ...

  8. 【转载】Fiddler工具使用介绍(一)

    原文https://www.cnblogs.com/miantest/p/7289694.html(一) https://www.cnblogs.com/miantest/p/7290176.html ...

  9. Caused by: java.lang.ClassNotFoundException: org.springframework.integration.handler.support.HandlerMethodArgumentResolversHolder

    <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring ...

  10. Linux(CentOs 7)系统重装笔记(一)

    参考文章: https://www.jb51.net/article/95263.htm https://blog.csdn.net/JackLiu16/article/details/7988182 ...