Solved

Syncing old server to new - MySQL

Posted on 2014-02-14
9
203 Views
Last Modified: 2014-02-25
We have a web server that is crashing/unstable - and a new server that has been bare-metal installed from a backup from broken server about a week old.  There is, however, new data (both mysql and actual PHP files.)

I'm going to break this up into two questions - this is just for the MySQL.

How would you recommend I go about syncing up just the newer files?  Is there a way for me to just transfer over the relevant MySQL files and doing so will it automatically "update" due to the replacement?  My normal way of doing it would be to go site by site and through phpMyAdmin export the tables/databases...then import them into the databases on the new server...but that will kinda suck.  Is there a quicker/more efficient way of doing it?

Thanks in advance!
0
Comment
Question by:erzoolander
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 40

Expert Comment

by:noci
ID: 39861373
You should be able to make an export from the old database & import that into the new one.
As long as the tables are NOT the same in the same 'database' you can import data.
0
 
LVL 21

Expert Comment

by:Mazdajai
ID: 39862113
Have you try tar up the entire directory (mysql/php) from source and extract it to the target?
0
 
LVL 40

Expert Comment

by:noci
ID: 39862563
@MAzdajai, that can only be done if the source was halted before the copy is taken
AND more important if the replica doesn't need to be merged into an existing database on the target.

Otherwise you will delete all existing data on the destination.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 13

Expert Comment

by:Sandy
ID: 39864443
Create Master/ Slave config and perform the replication once done convert slave in master.

TY/SA
0
 
LVL 21

Expert Comment

by:Mazdajai
ID: 39865163
It sound like the new server is not yet in production and the goal is to restore the php and mysqld in the quickest manner. (I could be wrong of course)

IMHO it is easier restore them on the system level versus on the application level... I am not aware you can globally restore all web sites via phpmyadmin.
0
 
LVL 1

Author Comment

by:erzoolander
ID: 39865625
Nope - the PhPMyAdmin level I was pretty much thinking going on a site by site basis...and you're correct...it's not yet in production.  It's still set as a staging server as I'm migrating all of the data over.

I'd LIKE to be as quick as possible about it - so I'm wondering if there's a way to go on to the old server and say "Export everything" from shell/root...and then go to the new server and essentially "restore" with a similar command to re-import everything back in.

My only concern about that - however - is that the system is administered by PLESK...and I'd be afraid that doing a global export might screw something up.  So I'd rather just say Dump databases A, B, C, D and then on the new server import A, B, C, D - leaving everything else in tact.

Is that a decent approach you think - and is there way for me to from root/shell export just a given number of databases/then reimport them?

Thanks!
0
 
LVL 21

Expert Comment

by:Mazdajai
ID: 39872343
>>if there's a way to go on to the old server and say "Export everything" from shell/root...and then go to the new server and essentially "restore"
Have you consider my above suggestion? This is a cold dump therefore you would need to stop mysql.

It is not possible to export certain database on the system level. You can only achieve  that with the help of mysqldump binary -

mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

Open in new window

0
 
LVL 40

Accepted Solution

by:
noci earned 500 total points
ID: 39875348
and in the previously mentioned mysqldump --all-databases  can dump ALL relevant databases.
(i.e. not the dictionary databases).
No database needs to be mentioned then:


mysqldump -u root -p[root_password] --all-databases > dumpfilename.sql

Open in new window

or
mysqldump -u root -p[root_password] -A > dumpfilename.sql

Open in new window

0
 
LVL 1

Author Closing Comment

by:erzoolander
ID: 39887744
Gracias!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question