If you host a large database that can't be split up, and your server doesnt have the resources to handle it, you can setup mysql to be run on an external server. This shouldn't be needed too often, as usually, you can just move entire user accounts to another server to ease the load. But in the case of one large database using up the whole server, then you dont' have much choice.
Note that this guide does not transfer any databases over. It's generally a good idea to do this before you add users. Also, mysql will continue to run on your local DA.. so existing databases and scripts should continue to function, but users will not be able to control them through DA.
1)The first step is to install mysql onto the remote server. DA is not require on this server, as it is just used for mysql and nothing else. I won't go into the detail on how to do this (use google).
2) The next step is to setup a user that DA can connect to on the remote mysql server. The default DA uses is da_admin, so staying with that name is a good idea, but not required.
You can use this guide to setup the da_admin user on your server: help.directadmin.com/item.php?id=45. The username and password you setup have to be set in the /usr/local/directadmin/conf/mysql.conf file for DA to use.
On a related note, if the remote server is on a LAN IP, and the connecting IP to that remote server will not be your server IP, but rather some other IP such as a 192.168.x.x type of IP then you can use this guide to add an access host by default instead of the server IP: directadmin.com/features.php?id=818.
Note that the above guide will only grants da_admin on the "localhost", meaning you have to already be on that remote mysql server to use the account. We'll need to add another acccess hsot (ip) to allow the DA server to connect to it. Basically, you just run the "GRANT ALL PRIVILEGES ON *.* TO da_admin@localhost" command again, but you change localhost to the IP of your DA server,
GRANT ALL PRIVILEGES ON *.* TO email@example.com WITH GRANT OPTION; FLUSH PRIVILEGES;
we don't need the "identified by 'pass'" again, because the password is already from adding it the first time.
3) At this point.. the remote mysql database should be setup and ready to accept DA to use it. Test it out by logging into your DA machine via ssh, and type:
mysql -uda_admin -p --host=220.127.116.11
where 18.104.22.168 is the IP of your mysql server. If you can't connect, go back over your settings again.. also make sure that port 3306 is open on the remote box.
4)Now.. the easier part is to tell DA to use the remote server. Edit:
add the line:
where 22.214.171.124 is the IP of your remote server. Make sure there is a newline character at the end of the line.. (Eg, press enter)
5) That should be it. Go into DA and check the mysql section of your user level to see if you get any errors. If not, try adding a database to make sure it works.
6) The only cleanup task would then be to fix up phpMyAdminto also connect to the remote host.
Find this line:
$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address
and change it to
$cfg['Servers'][$i]['host'] = '126.96.36.199'; // MySQL hostname or IP address