Difference between revisions of "XMission Control Panel/MySQLdump"

From XMission Wiki
Jump to: navigation, search
(Usage)
 
(6 intermediate revisions by one other user not shown)
Line 15: Line 15:
 
|'''mysqldump:'''
 
|'''mysqldump:'''
 
|invokes the mysqldump command
 
|invokes the mysqldump command
 +
|-
 +
|'''-h:'''
 +
|specifies what host to connect to, but is not needed if connecting to localhost. '''Still we recommend using it to be sure of where content is obtained from'''
 
|-
 
|-
 
|'''-u:'''
 
|'''-u:'''
Line 37: Line 40:
 
*The --add-drop-table switch will ensure that when the SQL is uploaded to another SQL server it drops the tables before creating them.
 
*The --add-drop-table switch will ensure that when the SQL is uploaded to another SQL server it drops the tables before creating them.
  
<br><br>
+
[[Category: Control Panel]]
{{:Cloud}}
 
[[Category:Cloud Hosting|MySQLdump]]
 
[[Category:Cloud Server]]
 

Latest revision as of 14:29, 25 September 2018

What is MySQLdump

MySQLdump is a tool used to dump a database or a collection of databases for backup or transfer to another SQL server. It can be used to migrate databases to and from your Cloud Servers.

Simply put, MySQLdump outputs the SQL statements that were used to create a database, tables and all of the data in the tables. It can output these statements in multiple formats and with more or less output information as needed.


Usage

  • Since mysqldump just outputs SQL statements it is usually helpful to truncate the output to a file. A common mysqldump may look like this:
mysqldump -h'localhost' -u'b_89756' -p 'databasename' > databasename.sql

Looking at this command piece by piece makes it easy to understand.

mysqldump: invokes the mysqldump command
-h: specifies what host to connect to, but is not needed if connecting to localhost. Still we recommend using it to be sure of where content is obtained from
-u: specifies the user to login to mysql as
-p: tells mysql to ask for a password
databasename: specifies which database to dump
> databasename.sql: truncates the output of the mysql command to a file

Switches


Helpful Tips

  • The -D switch can be used to dump a skeleton of a database without any data in it.
  • The --add-drop-table switch will ensure that when the SQL is uploaded to another SQL server it drops the tables before creating them.