zoukankan      html  css  js  c++  java
  • 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 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
  • 相关阅读:
    python模块之sys与os
    Python模块之time、datetime
    一行代码解决各种IE兼容问题,IE6,IE7,IE8,IE9,IE10
    js闭包
    js删除局部变量
    数据库 事务
    jQuery全屏滚动插件fullPage.js
    jdk环境变量
    MyEclipse优化设置(最详细版本)
    oracle查询性能优化
  • 原文地址:https://www.cnblogs.com/Robbery/p/10112933.html
Copyright © 2011-2022 走看看