Database MySQL backup command, manually backup MySQL database

MySQL database backup

When manually backing up the MySQL database, you need to enter the following command for manual backup without using tools

Example

The code block syntax follows the standard markdown code, for example:

mysqldump -h 数据库所在机器地址 -u root -p 数据库名称 > 数据库名称.sql;

For example: my database name is cfbase, then my operation steps are as follows:
1. Open the run window with Windows + R, and then enter cmd, as shown in the figure below:
Run window
cmd window
2. Enter the command in the dos window:

mysqldump -h localhost -u root -p cfbase > cfbase.sql;

Enter the database username and password as prompted

Note: The
parameter -u is the database account you are using, where the account name is root, and the -p parameter is the user name and password. When this is empty, you will be prompted for the access password after you press Enter;

Write picture description here
After backup, the database file you backed up will appear in the current path, and the end of the file is.mysql
Backed up database file

Finally, note that
if the database backup is not successful, then cmd to open a command window when an administrator runs

It is recommended that database backups use timing scripts for backup, bat for timing task settings under Windows, and shell scripts for Unix and Linux derivatives.


This article is original, please indicate the source for reprinting, thank you for your advice;

For MySQL automatic backup script under Linux, please refer to my friend's article: https://blog.csdn.net/my_interface/article/details/80804657

Guess you like

Origin blog.csdn.net/Uridis/article/details/81451082