|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.
- 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).
- 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;we don't need the "identified by 'pass'" again, because the password is already from adding it the first time.
- 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=18.104.22.168where 22.214.171.124 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.
- Now.. the easier part is to tell DA to use the remote server. Edit:
add the line:
where 126.96.36.199 is the IP of your remote server. Make sure there is a newline character at the end of the line.. (Eg, press enter)
- 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.
- 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 addressand change it to
$cfg['Servers'][$i]['host'] = '188.8.131.52'; // MySQL hostname or IP addresswhere 184.108.40.206 is the IP of your mysql server.
- For new MySQL User databases, you'll want to tell DirectAdmin about the new IP, so they have that IP assigned into their access hosts:
"host" value in the mysql.conf for remote database control
or Ability to add multiple access_host values upon DB creation if you need that.
As of DirectAdmin 1.57.0, you can install DirectAdmin without MySQL, allowing you to specify a remote box ahead of time: