Solved

Syncing old server to new - MySQL

Posted on 2014-02-14
9
202 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
 
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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now