However, as my project require to have a dedicated centralize database server, and the application is reside in other server, so I have to configure the application and MySQL to allow connection from outside localhost. As we all know, by default, MySQL only allow connection or access from within the localhost.
So here’s the solution for this case,
edit your /etc/mysql/my.cnf and change the bind address:
$ sudo vim /etc/mysql/my.cnf
find the word ‘bind-address’ and change 127.0.0.1 to your IP.
Then login to the mysql console:
$ mysql -uroot -pYOURROOTPASSWORDNow you can access your database from outside localhost:
mysql> GRANT ALL PRIVILEGES ON *.* TO [email protected] IDENTIFIED BY “PASSWORD”;
mysql> FLUSH PRIVILEGES;
mysql> exit
$ mysql -uUSERNAME -pPASSWORD -h MYSQL_SERVER_IP
No comments:
Post a Comment