If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Copying a database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-20-05, 00:06
linuxnewb linuxnewb is offline
Registered User
 
Join Date: May 2004
Posts: 11
Copying a database

Helloo Everyone,

I would like to copy a database so I can relocate it and the php pages onto another system. What command do I use to copy the database?

Thanks!
Reply With Quote
  #2 (permalink)  
Old 10-20-05, 13:15
jfulton jfulton is offline
Registered User
 
Join Date: Apr 2005
Location: Baltimore, MD
Posts: 297
You need to dump the database data and table structures into a file. Then read that file into MySQL on the new server. I've never dumped using the command line, but check the mysql pages for detailed info and which options to use. To read back in, just use '<' or 'source' from the shell.

Quote:
The most common use of mysqldump is probably for making a backup of an entire database:

shell> mysqldump --opt db_name > backup-file.sql

You can read the dump file back into the server like this:

shell> mysql db_name < backup-file.sql

Or like this:

shell> mysql -e "source /path-to-backup/backup-file.sql" db_name
from:http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html
Reply With Quote
  #3 (permalink)  
Old 10-20-05, 16:35
khibinite khibinite is offline
Registered User
 
Join Date: Oct 2003
Posts: 63
Quite right: mysqldump is a right way to make copy of your database.
Reply With Quote
  #4 (permalink)  
Old 10-20-05, 21:26
expert-db expert-db is offline
Registered User
 
Join Date: Mar 2004
Posts: 33
Lightbulb

Hi,

Try to export the database through mysqldump or any available GUI's or check the option transfer database available in the major mySQL managers.


Regards,
Reply With Quote
  #5 (permalink)  
Old 10-23-05, 18:43
linuxnewb linuxnewb is offline
Registered User
 
Join Date: May 2004
Posts: 11
Angry Database

This function does not seem to work.....do I log into mysql or do I complete this from shell? My datbase name is accm. Does that help?
Reply With Quote
  #6 (permalink)  
Old 10-23-05, 20:40
jfulton jfulton is offline
Registered User
 
Join Date: Apr 2005
Location: Baltimore, MD
Posts: 297
From the shell:

mysqldump --opt accm > backup-file.sql

You may also need to specify the host, username, password, etc. Check out http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html for more info on that and which options you may want to use.
Reply With Quote
  #7 (permalink)  
Old 10-23-05, 22:06
linuxnewb linuxnewb is offline
Registered User
 
Join Date: May 2004
Posts: 11
-bash mysqldump: command not found

How do I install this?
Reply With Quote
  #8 (permalink)  
Old 10-24-05, 10:18
jfulton jfulton is offline
Registered User
 
Join Date: Apr 2005
Location: Baltimore, MD
Posts: 297
mysqldump should already be included. Make sure the MySQL bin directory is in your PATH environment variable. For bash, I believe the command to set is 'export'...:
export PATH=$PATH:/pathto/mysqlbin/
Or try running the command from the bin directory.
Reply With Quote
  #9 (permalink)  
Old 12-21-05, 02:22
db_ilinksys db_ilinksys is offline
Registered User
 
Join Date: Dec 2005
Posts: 1
Besides mysqldump, could anyone tell me another methods to backup the entire database coz I might not know where the path of mysqldump is in other server. Thank you.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On