Remote MariaDB on Ubuntu 16.04 Tutorial
Posted: Tue Mar 28, 2017 9:22 pm
I'm posting this in hopes it will help someone out. I'm sure the code isn't the greatest and could have security issues, but it worked for me in my prototype environment.
The Setup:
In this next step, you will be asked to enter a root password for MySQL Root User. Enter and confirm.
Now it's time to install PHPMyAdmin . During the process below you will have to choose Apache 2 (Space Bar) and select NO for the dbconfig-common question that pops up.
To allow remote connections, we will need to edit the MySQL my.cnf file to change the bind address to the current server private IP address. Using the steps below, find the [mysqld] part in the my.cnf file and change the database IP on the line Bind Address = XX.XX.XX.XX to this database server private IP address of 987.654.321.2.
Restart MySQL Service
Login to MySQL and Create VestaCP Remote User with Full Permissions
Restart MySQL Service
Secure MariaDB
Change php.ini if you want to modify upload sizes, memory limit, execution time, etc.
Restart Apache
Install VestaCP on Webserver
Setup Remote Database Connection in VestaCP using the MySQL user info created above with the MySQL Private IP Address.
Change php.ini if you want to modify upload sizes, memory limit, execution time, etc.
Restart Apache
ALL DONE!
I am still working on my PHPMyAdmin settings. I got it to work once before where the actual link in VestaCP took you to the correct PHPMyAdmin on the remote server. Otherwise everything works great in my experience and localhost is nowhere to be found!
The Setup:
- 2 Digital Ocean 2 CPU/2GB RAM Droplets
- VestaCP Webserver:
- Public IP: 123.456.789.1
Private IP: 987.654.321.1
- Public IP: 123.456.789.2
Private IP: 987.654.321.2
- Public IP: 123.456.789.1
- VestaCP Webserver:
Code: Select all
apt-get update && apt-get upgrade && apt-get dist-upgrade
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu xenial main'
sudo apt update
Code: Select all
sudo apt install mariadb-server
Code: Select all
sudo apt-get update
sudo apt-get install phpmyadmin php-mbstring php-gettext
sudo phpenmod mcrypt
sudo phpenmod mbstring
sudo service apache2 restart
Code: Select all
sudo nano /etc/mysql/my.cnf
Code: Select all
sudo service mysql restart
Code: Select all
mysql -u root -p
Create User vestacproot@'%' Identified By 'VestaAndCookies1';
Grant All On *.* To vestacproot@'%' With Grant Option;
FLUSH PRIVILEGES;
exit;
Code: Select all
sudo service mysql restart
Code: Select all
mysql_secure_installation
Code: Select all
sudo nano /etc/php/7.0/apache2/php.ini
Code: Select all
sudo service apache2 restart
Code: Select all
apt-get update && apt-get upgrade && apt-get dist-upgrade
wget https://vestacp.com/pub/vst-install.sh
sudo apt-get install mysql-client
bash vst-install.sh --force --nginx yes --apache yes --phpfpm no --named yes --remi yes --vsftpd yes --proftpd no --iptables yes --fail2ban yes --quota no --exim no --dovecot no --spamassassin no --clamav no --mysql no --postgresql no --hostname panel.yoururl.com --email [email protected] --password ILikeCookies2
Code: Select all
export VESTA=/usr/local/vesta/
/usr/local/vesta/bin/v-add-database-host mysql 987.654.321.2 vestacproot VestaAndCookies1
/usr/local/vesta/bin/v-list-database-hosts
Code: Select all
sudo nano /etc/php/7.0/apache2/php.ini
Code: Select all
sudo service apache2 restart
I am still working on my PHPMyAdmin settings. I got it to work once before where the actual link in VestaCP took you to the correct PHPMyAdmin on the remote server. Otherwise everything works great in my experience and localhost is nowhere to be found!