allow remote mysql access (through webmin or shell)
Login mysql mysql -u yourname -p yourpassword
,then follow like this
mysql>use mysql;
mysql>select host,user from user;
It may give the following result:
+-----------+------------------+
| host | user |
+-----------+------------------+
| 127.0.0.1 | root |
| ::1 | root |
| localhost | debian-sys-maint |
| localhost | root |
+-----------+------------------+
4 rows in set (0.00 sec)
If you see that, it means you can only connect mysql in localhost,so you need do the following steps:
mysql>GRANT ALL PRIVILEGES ON *.* TO username@"%" IDENTIFIED BY "password";
Query OK, 0 rows affected (0.00 sec)
mysql>flush privileges;
Query OK, 0 rows affected (0.00 sec)
"%"
means any host can remotely log on to the server,if you want to restrict access to only a machine,you need to change the "%"
to the IP address of the machine you want to allow to connect.
If it works,then you select host,user from user;
,you will get the following info:
+-----------+------------------+
| host | user |
+-----------+------------------+
| % | root |
| 127.0.0.1 | root |
| ::1 | root |
| localhost | debian-sys-maint |
| localhost | root |
+-----------+------------------+
5 rows in set (0.00 sec)
Exit mysql,edit /etc/mysql/my.cnf
,find
# 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
annotate it or you can delete it(not recommended),restart your mysql server,usingservice mysql restart
,if you do this like me,you may solve the problem.
It works well in my computer(ubuntu 14.04+mysql 5.5)