1 modify the /etc/mysql/my.cnf
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
you see the bind-address, comment it. 注掉它。
2 update the database -- mysql.
shell > mysql -uroot -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| mysql |
+--------------------+
5 rows in set (0.00 sec)
mysql> select t.host, t.user from user t;
+-----------+------------------+
| host | user |
+-----------+------------------+
|127.0.0.1 | debian-sys-maint |
|127.0.0.1 | james |
| 127.0.0.1 | root |
| debian | root |
| localhost | root |
+-----------+------------------+
5 rows in set (0.00 sec)
mysql > update user set host='%' where user='yourUsername';
mysql > flush privileges;
remark:
if wanna create user please follow:
create user 'james'@'%' identified by 'password';