MySQL: Difference between revisions

From Psygen Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
Note: never use <code>kill</code> to kill MySQL. Use <code>service</code>, or <code>systemctl</code> instead.
Note: never use <code>kill</code> to kill MySQL. Use <code>service</code>, or <code>systemctl</code> instead.


== Backup and Restore ==
== Backup (Dump) ==


To backup (dump) a single database:<br />
To backup (dump) a single database:<br />
Line 8: Line 8:
Backup all databases:<br />
Backup all databases:<br />
<code>mysqldump --all-databases > all_databases.sql</code>
<code>mysqldump --all-databases > all_databases.sql</code>
== Restore ==
Restore a database:<br />
<code>mysql database_name < database_name.sql</code>
Restore one database from a dump of all the databases:
<code>mysql --one-database database_name < all_databases.sql</code>


== Version ==
== Version ==
See: [[Software Versions]] to check the installed version.
See: [[Software Versions]] to check the installed version.

Revision as of 04:37, 17 February 2017

Note: never use kill to kill MySQL. Use service, or systemctl instead.

Backup (Dump)

To backup (dump) a single database:
mysqldump database_name > database_name.sql

Backup all databases:
mysqldump --all-databases > all_databases.sql


Restore

Restore a database:
mysql database_name < database_name.sql

Restore one database from a dump of all the databases: mysql --one-database database_name < all_databases.sql


Version

See: Software Versions to check the installed version.