Remote mySQL server and local host

max2000

Verified User
Joined
Nov 7, 2004
Messages
141
Location
Europe
Hi,

I am going to install a remote mySQL server to lower the load on one of my DA boxes.

I will do it this way:

- Install the same version of mySQL on the remote server

- Stop mysqld on DA server

- Copy all the files on /var/lib/mysqld/ from DA to mySQL server

- Create da_admin user on mySQL server using this toturial:

http://help.directadmin.com/item.php?id=45

- Edit /usr/local/directadmin/conf/mysql.conf on the DA server to add:

host=1.2.3.4

Where 1.2.3.4 is the IP of the remote mySQL server

- Edit /var/www/html/phpMyAdmin/config.inc.php

to replace the line:

$cfg['Servers'][$i]['host'] = 'localhost';

by:

$cfg['Servers'][$i]['host'] = '1.2.3.4';

To let phpmyadmin know where the mySQL server is

Over.

But I still have one question:

- my customers are using "localhost" as mySQL server on their installation. Do they need to change and put mySQL server IP?

Is there anyway to instruct DA server to consider:

localhost=1.2.3.4 ?

Thank you for your help. I will keep you updated about this project.
 
you can change the hostname look up addres in /etc/hosts
but IMO this is not a good idea as some stuff may depend on localhost other than 127.0.0.1

additionally you need to
1, backup `mysql` (the DB) before you do the followings
2, change the Host of each records in mysql.db to the server IP

UPDATE db SET Host='1.2.3.4' WHERE Host='localhost'

3, duplicate each records in mysql.user...1 record with Host='localhost' and antoher one have Host='1.2.3.4'
if you dont leave the localhost records you will have problem in adding access host in DA

how i did is to copy the table and UPDATE the host in the new table, and then INSERT all rows from the old table to the new table.
 
Back
Top