Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-20-2013, 03:44 AM   #1
LQ Newbie
Registered: Dec 2013
Posts: 7

Rep: Reputation: Disabled
copying mysql db to another machine

I would like to move mysql db from existing server to another new installed server , I found the below link , but I think this method need to do export data and import for each db , could advise any method that do all db copying for one time ? thanks
Old 12-20-2013, 03:47 AM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
How hard is it to just run a few commands once for each database? Script it if you need to.
Old 12-20-2013, 03:48 AM   #3
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,406

Rep: Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396
Try this page
you dump any/all dbs, your choice.
Gives you a backup as a side effect and also defrags the new copies as well.
Old 12-20-2013, 05:04 AM   #4
Registered: Jul 2008
Location: Bangalore, India
Distribution: RHEL
Posts: 235

Rep: Reputation: 41
In Summary, it is a three step process :
a) Step One—Perform a MySQL Dump
mysqldump -u root -p --opt [database name] > [database name].sql

b) Step Two—Copy the Database
scp [database name].sql [username]@[servername]ath/to/database/

c) Step Three—Import the Database
mysql -u root -p newdatabase < /path/to/newdatabase.sql

Most links available online will summarise the things around these only.
Old 12-20-2013, 05:19 AM   #5
Senior Member
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
For the daring rsync the content while the db is stopped to the other machine. Run checkusm over tables to see if all went well. Only works if both database servers are of the same version.
Old 12-20-2013, 05:42 AM   #6
Registered: May 2006
Location: Orion–Cygnus Arm, MWG
Distribution: Slackware 14.2
Posts: 213

Rep: Reputation: 121Reputation: 121
In addition to the above you may need to run mysql_install_db on a new installation of mysql. Also if you find your downloads exiting during import or export check out the config item max_allowed_packet in /etc/my.cnf and set it higher.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] copying python modules form other machine project.linux.proj Linux - Newbie 1 03-18-2013 06:01 AM
copying files from host to virtual machine sanaz Linux - Virtualization and Cloud 17 12-07-2012 09:01 PM
How can I maintain ownership copying from one machine to another? laggerific Linux - Software 2 08-19-2008 11:04 AM
installation by copying it from one machine to another machine betrussell23 Linux - Newbie 5 03-05-2007 09:56 AM
Complicated one: MySQL, rsync, remote machine, local machine daiver Linux - General 2 02-27-2006 12:14 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:28 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration