mysql导入外部.sql文件时错误

时间:2021-12-01 00:24:30

当前环境:

  操作系统:windows 7

  mysql版本:5.5.36 MySQL Community Server (GPL)

 

当我第一次导入.sql文件时报错:

mysql> source C:\Users\DanteJ\Desktop\ideal_base.sql;
ERROR:
Unknown command '\U'.
ERROR:
Unknown command '\D'.
ERROR:
Unknown command '\D'.
ERROR:
Unknown command '\i'.

从上面的错误可以看出mysql命令不认识windows文件路径中的反斜杠“\”符号,所以我们把反斜杠改为斜杠“/”,再次执行,结果如下:

mysql> source C:/Users/DanteJ/Desktop/base_db.sql;
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.01 sec)

.............

导入成功。