back home

Setup a remote database server Ubuntu 16.04

February 21, 2018

0. Update system

$ apt-get update
$ apt-get upgrade

1. Install MySQL Database Server

$ apt-get install mysql-server

2. Configuring MySQL to Listen for Remote Connections

$ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld]
. . .
bind-address = db_server_ip

3. Restart Mysql

$ sudo systemctl restart mysql

4. Create remote user

$ mysql -uroot -p
CREATE USER 'remoteuser'@'localhost' IDENTIFIED BY 'mypass';
CREATE USER 'remoteuser'@'%' IDENTIFIED BY 'mypass';
GRANT ALL ON *.* TO 'remoteuser'@'localhost';
GRANT ALL ON *.* TO 'remoteuser'@'%';