Learn how to set up DirectAdmin to use a Remote MySQL Server. Our MySQL Support team is here to help you with your questions and concerns.
Set up DirectAdmin to Use a Remote MySQL Server
Did you know that we can set up MySQL to run on an external server if we have a large database that needs management and monitoring of its own?
By hosting MySQL on a different server, we can connect our application to the Remote MySQL database easily.
Let’s take a quick look at how we can set up DA to use a Remote MySQL Server:
- First, we have to install MySQL on the remote server.
- Then, we must create or setup up a user that a DirectAdmin can get connected to on the remote MySQL server. In most cases, DirectAdmin’s default user is da_admin. If so, a connection with the same name is easier but not necessary.
- Next, we have to set the username and password of the new user in the /usr/local/directadmin/conf/mysql.conf file. This enables DirectAdmin to use it.
Our experts would like to point out that if the remote server is on a LAN IP in addition to the connecting IP to the remote server not being the same as the server IP, but some other IPs, we have to add an access host by default in the /usr/local/directadmin/conf/mysql.conf file.
- Now, we have to add the following to the /usr/local/directadmin/conf/mysql.conf file:
access_host=x.x.x.x
Here, x.x.x.x is the IP. Otherwise, the host will become the IP address of the remote database server.
Furthermore, this works only if we are already on the remote MySQL server to use the account. We have to add another access host or IP in order to permit the DA server to connect to it. Either we can run the following command again
GRANT ALL PRIVILEGES ON *.* TO da_admin@localhost command
However, we can also modify localhost to the IP of our DA server as seen below:
GRANT ALL PRIVILEGES ON *.* TO da_admin@1.2.3.4 WITH GRANT OPTION;
FLUSH PRIVILEGES;Since the password is already added, we do not need “identified by pass” again.
- Now, the remote MySQL database is ready and will allow the DA to use it. We can test this by logging in to our DirectAdmin via SSH and then running:
mysql -uda_admin -p –host=x.x.x.x
Here, x.x.x.x is the IP of our MySQL server.
In case we cannot connect, our experts recommend checking the settings and ensuring the MySQL port 3306 is open on the remote box.
- Next, we have to edit the /usr/local/directadmin/conf/mysql.conf file and add the following code:
host=x.x.x.x
- Then, we have to check the MySQL section of our user level by entering DirectAdmin to check if we are getting any errors related to this. If not, then add a database to ensure it works.
- Next, we must set up phpMyAdmin also to connect to the remote host. This is done by editing the /var/www/html/phpMyAdmin/config.inc.php file and changing the following line
$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address
To
$cfg['Servers'][$i]['host'] = 'x.x.x.x'; // MySQL hostname or IP address
Here, x.x.x.x is the IP of our MySQL server.
- Finally, our experts recommend telling DirectAdmin about the new IP for new MySQL user databases in order to assign the IP to their access hosts.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
In summary, our Support Techs demonstrated how to set up DirectAdmin to use a Remote MySQL Server
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments