Kayako Logo
Technical Chat From server configurations to local area networking - the technical discussion forum.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  (#1) Old
Jamie Edwards Offline
Operations Manager
 
Jamie Edwards's Avatar
 
Posts: 4,390
Join Date: Jan 2006
Location: UK

SupportSuite
Owned License

Taking (backing up) and restoring MySQL dump files - 21-04-2007, 09:39 PM

Via SSH / MySQL CLI command interface:

Dumping a database into a file:
Code:
mysqldump -u username -ppassword databasename > dumpfilename.sql
The above command will dump the contents of databasename into a MySQL dump file named dumpfilename.sql that can later be used to drop back into a MySQL database. The username you give must be for an account that has the correct access privileges to this database.

The file will be saved relative to the location in which you executed the command. So, if you execute the command whilst in the /home/ folder, the dumpfile will be saved to /home/dumpfilename.sql.

Note: If you add the parameter "--opt", it will create the database with options to drop existing tables and data when the dump file is imported into a database.


Restoring a MySQL dump file:
Code:
mysql -u username -ppassword databasename < dumpfilename.sql
The above command will drop the contents of the dump file dumpfilename.sql into the database named databasename. Normally, tables will be overwritten using this procedure if they already exist.


Jamie Edwards (jamie.edwards ]at[ kayako.com)
----------------------------------------------------------------
---
  • New to the forum? New user's guide here.
  • Submit bug reports here.
  • Submit support tickets via the members area.
  • Submit sales queries either via live chat or via e-mail.
  • There is no official ETA on Version 4.

Last edited by Jamie Edwards : 21-04-2007 at 10:37 PM.
   
Reply With Quote
  (#2) Old
bear Offline
Community Moderator
 
Posts: 662
Join Date: Jan 2005

SupportSuite
21-04-2007, 10:35 PM

If you add one thing to that "--opt", it will create the database with options to drop existing tables and data on restore, avoiding errors and complaints from mysql.
Code:
mysqldump --opt -u ....
Also, the -p must be followed immediately by the password, no spaces. It would see the space as part of the password and reject it.
   
Reply With Quote
  (#3) Old
Jamie Edwards Offline
Operations Manager
 
Jamie Edwards's Avatar
 
Posts: 4,390
Join Date: Jan 2006
Location: UK

SupportSuite
Owned License

21-04-2007, 10:37 PM

Thanks for the suggestion, updated!


Jamie Edwards (jamie.edwards ]at[ kayako.com)
----------------------------------------------------------------
---
  • New to the forum? New user's guide here.
  • Submit bug reports here.
  • Submit support tickets via the members area.
  • Submit sales queries either via live chat or via e-mail.
  • There is no official ETA on Version 4.
   
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0

Kayako provides online help desk software and support solutions; enabling companies to improve their support and reduce costs.

Our three main products include: SupportSuite, eSupport and LiveResponse



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46