How to Sovle mysqldump backup Error on the MySQL command line

Today, when I was backing up with mysqldump, an error occurred. The following is my command for backing up the database:

mysql> mysqldump -hlocalhost -uroot -p myempoyees  student > "D:/backup/file.sql";

The following error reports occur:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL 
server version for the right syntax to use near 'mysqldump -hlocalhost -uroot -p myempoyees  student > 
"D:/backup/file.sql"' at line 1

But the command should be right

The result of online query: mysqldump is not a MySQL command, but a command line user program, which must be called by shell command line.

Execute the statement in the shell command window without entering the MySQL command

C:\Program Files\MySQL\MySQL Workbench 8.0>mysqldump -hlocalhost -uroot -p myempoyees  student >"D:/backup/file.sql"
Enter password: ******
C:\Program Files\MySQL\MySQL Workbench 8.0>

Enter the password and the backup is successful!

Similar Posts: