Learning Mysql



Download 4.24 Mb.
View original pdf
Page328/366
Date04.08.2023
Size4.24 Mb.
#61806
1   ...   324   325   326   327   328   329   330   331   ...   366
Learning MySQL
358 | Chapter 10:
Backups and Recovery

tables
Creates a dump of the specified database tables.
where
Dumps only records meeting a specified
WHERE
clause.
You can use mysqldump in four main ways (assume you want to get the database dump in the file outputfile.sql):
• To make a backup of all the databases on a MySQL server, use the command mysqldump --user=root --password=the_mysql_root_password \
--result-file=outputfile.sql --all-databases
This dumps CREATE DATABASE, USE, CREATE TABLE, and
INSERT
statements for all data in all databases that are accessible by the user root. If you specify a user other than root, the output is affected by the privileges of that user To make a backup of specific databases, use the command mysqldump --user=root --password=the_mysql_root_password \
--result-file=outputfile.sql --databases database_name
This dumps CREATE DATABASE, CREATE TABLE, and
INSERT
statements for only the specified databases. Use this if you want a CREATE DATABASE
statement, in preference to the variant we showed you at the beginning of this section.
You can list several databases one after the other in the command. For example,
to dump the music and wedding databases, you would type mysqldump --user=root --password=the_mysql_root_password \
--result-file=outputfile.sql -databases music wedding
• To make a backup of specific tables from a database, use the command mysqldump --user=root --password=the_mysql_root_password \
--result-file=outputfile.sql database_name table_name
You can list several tables, one after the other, in the command To make a backup of specific data from a table in a database, use the command mysqldump --user=root --password=the_mysql_root_password \

Download 4.24 Mb.

Share with your friends:
1   ...   324   325   326   327   328   329   330   331   ...   366




The database is protected by copyright ©ininet.org 2024
send message

    Main page