Rumah  >  Soal Jawab  >  teks badan

请问为什么我mysql本地非root无法连接 但是远程可以

配置如图
root是系统账号 root0是应用登陆的一个只有CURD权限但是没有更改表结构的账号

现在是远程开发应用可以连接 远程可以通过sqlyogg连接 但是在数据库所在的主机上无法连接(root正常)

....www/data$ mysql -uroot0 -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root0'@'localhost' (using password: YES)

迷茫迷茫2743 hari yang lalu707

membalas semua(2)saya akan balas

  • 伊谢尔伦

    伊谢尔伦2017-04-17 12:00:50

    感觉是不是 localhost和127.0.0.1 那两个重复了,你先试着修改一个看看行不行。

    balas
    0
  • 巴扎黑

    巴扎黑2017-04-17 12:00:50

    有没有 flush privileges ?

    我在本机的操作:

    MariaDB [test]> create user 'h2'@'%' identified by 'h2';
    Query OK, 0 rows affected (0.00 sec)
    
    MariaDB [test]> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    
    MariaDB [test]> select user, password, host from mysql.user where user = 'h2';
    +------+-------------------------------------------+------+
    | user | password                                  | host |
    +------+-------------------------------------------+------+
    | h2   | *196646D09F946D08C707DF3A0BCC3C9A2899E21B | %    |
    +------+-------------------------------------------+------+
    1 row in set (0.00 sec)
    
    xxoo@localhost ~ % mysql -uh2 -p                                                                                                
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 969
    Server version: 10.0.17-MariaDB-log MariaDB Server
    
    Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]> exit
    Bye
    
    

    balas
    0
  • Batalbalas