Solved

Syncing old server to new - MySQL

Posted on 2014-02-14
9
204 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
installing LSI MegaRAID Storage Manager on CentOS 7 22 702
Help on running oracle SQL script in linux 3 59
Securing Azure Oracle instance of Linux VM 4 65
linux 13 75
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

791 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