Remote MySQL

Allow Remote Access

If you would like to access remote MySQL server from EasyEngine, You have to adjust some settings on remote MySQL server.

vim /etc/mysql/my.cnf

# skip-networking 
bind-address = <PUBLIC_IP_OF_EASYENGINE_SERVER>

Now restart MySQL server:

service mysql restart

Grant Remote Access

mysql -u root -p

mysql > grant all privileges on *.* to 'root'@'<PUBLIC_IP_OF_EASYENGINE_SERVER>'  IDENTIFIED BY 'REMOTE_MySQL_PASSWORD' with grant option;
mysql> flush privileges;

Provide Remote MySQL Credential

For MySQL credential EasyEngine used /etc/mysql/conf.d/my.cnf file.
We need to add remote MySQL server details in  /etc/mysql/conf.d/my.cnf file

vim /etc/mysql/conf.d/my.cnf

[client]
host=<REMOTE_MYSQL_HOST>
user=<REMOTE_MYSQL_USER>
password=<REMOTE_MYSQL_PASSWORD>

Provide MySQL Grant Host Information

vim /etc/ee/ee.conf

[mysql]
    grant-host=<PUBLIC_IP_OF_EASYENGINE_SERVER>

Install MySQL Client

apt-get update
apt-get install mysql-client

Notes:

We used following variables:

  1. REMOTE_MYSQL_HOST = Remote MySQL server IP address/FQDN
  2. REMOTE_MYSQL_USER = Remote MySQL server username
  3. REMOTE_MYSQL_PASSWORD = Remote MySQL server password
  4. PUBLIC_IP_OF_EASYENGINE_SERVER = EasyEngine server public IP address/FQDN
  5. REMOTE_MySQL_PASSWORD = Remote MySQL password for root user

If your EasyEngine server don’t have static public IP address then
PUBLIC_IP_OF_EASYENGINE_SERVER = %

Now you can create any website with EasyEngine and now EasyEngine used your remote MySQL server for database creation.

Leave a Reply