LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 03: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, 03:47 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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, 05: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, 05: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, 05:42 AM   #6
coldbeer
Member
 
Registered: May 2006
Location: Orion–Cygnus Arm, MWG
Distribution: Slackware, Ubuntu
Posts: 249

Rep: Reputation: 130Reputation: 130
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:00 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
Open Source Consulting | Domain Registration