LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 12-20-2013, 04:44 AM   #1
amychan784
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


http://dev.mysql.com/doc/refman/5.0/...databases.html
 
Old 12-20-2013, 04:47 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

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

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
Try this page https://dev.mysql.com/doc/refman/5.1...ql-format.html.
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, 06:04 AM   #4
kapilbajpai88
Member
 
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, 06:19 AM   #5
zhjim
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, 06:42 AM   #6
coldbeer
Member
 
Registered: May 2006
Location: Orion–Cygnus Arm, MWG
Distribution: Slackware 14.2
Posts: 197

Rep: Reputation: 111Reputation: 111
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.
 
  


Reply


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 07:01 AM
copying files from host to virtual machine sanaz Linux - Virtualization and Cloud 17 12-07-2012 10:01 PM
How can I maintain ownership copying from one machine to another? laggerific Linux - Software 2 08-19-2008 12:04 PM
installation by copying it from one machine to another machine betrussell23 Linux - Newbie 5 03-05-2007 10:56 AM
Complicated one: MySQL, rsync, remote machine, local machine daiver Linux - General 2 02-27-2006 01:14 PM


All times are GMT -5. The time now is 08:40 PM.

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