Results 1 to 16 of 16
Thread: Copy MYSQL to another server.
-
09-04-2007, 09:38 AM #1Retired Moderator
- Join Date
- Feb 2005
- Location
- Delaware
- Posts
- 587
Copy MYSQL to another server.
I would like to copy all MYSQL databases, users, etc.. to another server.
One server is RHEL 4 and the other is RHEL5.
What do I need to copy to insure everything is moved over,
Thanks,
Jim
-
09-04-2007, 10:13 AM #2Newbie
- Join Date
- Sep 2007
- Posts
- 12
You have to install the same mysql version you have (recommended) on the new server and just copy whole mysql folder /var/lib/mysql
-
09-04-2007, 10:15 AM #3Retired Moderator
- Join Date
- Feb 2005
- Location
- Delaware
- Posts
- 587
Does it have to be the same version?
If not what specific files should I copy.
Thanks,
Jim
-
09-04-2007, 10:17 AM #4Newbie
- Join Date
- Sep 2007
- Posts
- 12
-
09-04-2007, 10:17 AM #5Web Hosting Master
- Join Date
- Apr 2004
- Location
- Singapore
- Posts
- 1,522
you might want to use mysqlhotcopy to copy all the database under /var/lib/mysql as one of the database contains all the permission rights.
tanfwc
-
09-04-2007, 12:11 PM #6Web Hosting Master
- Join Date
- Nov 2001
- Location
- Philadelphia, Pa
- Posts
- 948
-
09-04-2007, 12:34 PM #7Newbie
- Join Date
- Sep 2007
- Posts
- 12
Just stop mysql and copy everything. No 3rd party tools is needed.
-
09-04-2007, 02:54 PM #8Web Hosting Master
- Join Date
- Oct 2004
- Location
- Kerala, India
- Posts
- 4,771
You can write a small script to dump all the databases and copy those dump files to the new server and restore all dbs there.
If you are moving from mysql 4.1 to 4.0, just copying the /var/lib/mysql may cause issue. Here you need to take the 4.0 compatible dump and restore.David | www.cliffsupport.com
Affordable Server Management Solutions sales AT cliffsupport DOT com
CliffWebManager | Access WHM from iPhone and Android
-
09-04-2007, 04:52 PM #9Junior Guru Wannabe
- Join Date
- Jul 2006
- Posts
- 31
I would start with both servers on same version
then stop mysql on both servers
use rsync (search and find the commands needed) to copy the /var/lib/mysql to the new server
then upgrade the new server to the higher version
start off on the same level much fewer issues
-
09-04-2007, 08:31 PM #10
The safest and easiest way to do this is to do a dump of the database, NOT copy entire directories over. Simply do a dump of each and every database you want to copy over.
Copying the entire mysql directory will screw something up inevitably. Either you'll get something in the middle of a write, or you'll get something locke, or something, anything. Just do a dump. It's the safest and most effective way to move sql from host1 to host2.Tom Whiting, WHMCS Guru extraordinaire
Linux problems? WHMCS Problems? Give me a shout
Check out my WHMCS Addons
-
09-04-2007, 11:13 PM #11Web Hosting Master
- Join Date
- Oct 2004
- Location
- Kerala, India
- Posts
- 4,771
I agree 100% with linux-tech.
David | www.cliffsupport.com
Affordable Server Management Solutions sales AT cliffsupport DOT com
CliffWebManager | Access WHM from iPhone and Android
-
09-05-2007, 04:40 AM #12Newbie
- Join Date
- Sep 2007
- Posts
- 12
I do not agree. I agreed that this is the most correct way. What if you have to deal with foreign charsets and collations? In 10% cases database dump goes fine, but when you reload db it fails due to unrecognized characters etc. Therefore, IMHO the easiest, fastest and safest way is indeed to copy whole mysql folder.
-
09-05-2007, 04:59 AM #13
Not an option.
RHEL4 uses MySQL4
RHEL5 uses MySQL5
While you CAN upgrade, if you're not using something like CPanel to address things, you're going to run into issues with updates, dependencies, and, let's just say it'll be very very messy.
You can NOT copy binaries like this, as they will screw everything up. You DO want your server (mysql) running, right? You can NOT copy binary data like this, period.
The best, and safest method to do this is through mysqldump, or if you're lucky to be able to use it mysqlhotcopy. Even BETTER would be using something to automatically dump it into the new server.
If there were a better way to do things, by all means, let it be done, but copying entire mysql directories is the WRONG approach for this and WILL, in fact lead to more issues!Tom Whiting, WHMCS Guru extraordinaire
Linux problems? WHMCS Problems? Give me a shout
Check out my WHMCS Addons
-
09-05-2007, 05:15 AM #14Web Hosting Master
- Join Date
- Oct 2004
- Location
- Kerala, India
- Posts
- 4,771
David | www.cliffsupport.com
Affordable Server Management Solutions sales AT cliffsupport DOT com
CliffWebManager | Access WHM from iPhone and Android
-
09-05-2007, 06:01 AM #15Newbie
- Join Date
- Sep 2007
- Posts
- 12
If you read my first posts in this thread I wrote that it needs (recommended) to have the same versions of MySQL of both servers.
I think we talk about copying of MySQL to another server rather than copy with upgrade. In the upgrade case of course copying binaries will screw up everything but not exactly.
-
09-05-2007, 06:11 AM #16
Not possible
Unless you have customized your server (by which you wouldn't be asking here how to move a database), it's not going to happen.
RHEL4 comes with mySQL4 installed
RHEL5 comes with MySQL5 installed
Changing ANY of these, removing ANY of these without knowing what you're doing can cause CRITICAL ISSUES!
You can NOT move a "mysql4" directory to a "mysql5" directory and expect it to work.
You can NOT hotcopy a mysql4 server to a mysql5 server and expect it to work. It won't work.Tom Whiting, WHMCS Guru extraordinaire
Linux problems? WHMCS Problems? Give me a shout
Check out my WHMCS Addons