/opt/lampp/bin/mysql -uroot -h127.0.0.1 -p -A 

创建用户 允许所有IP 登录,授权location数据库

MariaDB [mysql]> select host,user,authentication_string from mysql.user;
+----------------+------+-----------------------+
| host           | user | authentication_string |
+----------------+------+-----------------------+
| localhost      | root |                       |
| 127.0.0.1      | root |                       |
| ::1            | root |                       |
| localhost      |      |                       |
| %              | root |                       |
| localhost      | pma  |                       |
| 172.17.182.111 | root |                       |
| 47.93.27.106   | root |                       |
+----------------+------+-----------------------+
8 rows in set (0.00 sec)

MariaDB [mysql]> create user 'mingzhanghui'@'%' identified by 'Mzh123';
Query OK, 0 rows affected (0.03 sec)

MariaDB [mysql]> grant all privileges on zjp4.* to 'mingzhanghui'@'122.70.41.200' identified by 'Mzh123';
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

如果出现错误  

ERROR 1396 (HY000): Operation CREATE USER failed for 'mingzhanghui'@'192.168.4.157'

 

use mysql;

flush privileges;

drop user 'mingzhanghui'@'192.168.4.157';