使用source导入MySQL出现“ERROR: Failed to open file xx, error: 2“问题的解决

我在Linux系统里成功导入过sakila数据库,
但在Windows系统使用如下方法导入数据,报
ERROR: Failed to open file 'D:\works\学习\素材\MySQL\sakila-db\sakila-schema.sql', error: 2
错误:

mysql> source D:\works\学习\素材\MySQL\sakila-db\sakila-schema.sql
ERROR:
Failed to open file 'D:\works\学习\素材\MySQL\sakila-db\sakila-schema.sql', error: 2

我的解决办法是,将源文件sakila-schema.sql放到不带中文的目录下,重新导入就可以了:

mysql> source D:\works\sql_demo\sakila-schema.sql
Query OK, 0 rows affected (0.04 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.07 sec)

Query OK, 1 row affected (0.08 sec)

Database changed

想变强就得坚持!

你可能感兴趣的:(奇技淫巧,mysql,数据库,java,linux)