Set allow remote connection to MySQL (Ubuntu for example)
MySQL default configuration is not allowed for remote connection, for security!
But I need to do this;
start to change configuration;
#1 Set User Rights
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the present input statement.mysql> use mysql# view current settings mysql> select Host,user from user; #修改mysql > UPDATE user SET host= '% ' WHERE user= ' root ' and host= ' localhost ' LIMIT 1; --'% ' means all allow host remote, here can fill in trusted host
#方法二 new user, set Allow remote connection mysql> GRANT all privileges on *. * to ' root ' @ ' 192.168.0.154 ' identified by ' with GRANT Option;
--or Allow all IP access:mysql> GRANT all privileges on * * to [email protected] "%" identified by "Mysqluser";
#2修改配置文件
"MySQL configuration under Ubuntu is located in/etc/mysql/my.cnf if not, you can use the command locate my.cnf find" [email protected]:/etc/mysql# vi my.cnf find ... Bind-address = 127.0.0.1 ... comment out #bind-address = 127.0.0.1:wq Save
#3测试
Ok! Bye
Set allow remote connection to MySQL (Ubuntu for example)