有没有 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