我尝试了以下查询,但我发现了错误。
mysql> mysqldump test |mysql test1;
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 test |mysql test1' at line 1
mysql> mysqldump test |mysql test1
-> ;
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 test |mysql test1' at line 1
mysql>
答案 0 :(得分:1)
您必须在命令提示符下使用这些命令。
语法:
mysqldump --opt -u [uname] -p[pass] [dbname] > [backupfile.sql]
即
C:\>mysqldump --all-databases > dump.sql
如果要为任何特定数据库创建转储,则必须在命令中提及该数据库名称。
C:\>mysqldump --databases yourdb > dump.sql
要导入数据库,您必须使用以下命令
C:\>mysql -p -u[user] [database] < dump.sql