MYSQL默认是不能导入文件的,可通过命令查看SHOW VARIABLES LIKE 'local_infile';
可通过以下设置为允许
SET GLOBAL local_infile = 1;
再次查询可看到,就OK了。

+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile  | ON    |
+---------------+-------+

ref:https://bugs.mysql.com/bug.php?id=72220

PS: shell下mysql的导出和导入

mysqldump -u username -ppassword database > database.sql

mysql -u username -ppassword database < database.sql
Last modification:May 8th, 2020 at 08:36 am