Home >Database >Mysql Tutorial >What is the way to backup database in mysql

What is the way to backup database in mysql

WBOY
WBOYforward
2023-05-28 09:28:05990browse

1. Back up all databases:

shell>mysqldump -uroot -p --all-database > all.sql

2. Back up database test

shell>mysqldump -uroot -p test > test.sql

3. Back up database Table emp under test

shell> mysqldump -uroot -p test emp > emp.sql

4, backup table emp under database test and dept

shell> mysqldump -uroot -p test emp dept > emp_dept.sql

5, Back up all tables under database test as comma-separated text to /tmp:

shell> mysqlddump -uroot -p -T /tmp test emp --fields-terminated-by ','
shell> more emp.txt  
 
1,z1
2,z2
3,z3
4,z4

The above is the detailed content of What is the way to backup database in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete