由于mysql的配置,一般情况下,不允许从其他目录导入文件
需要将要导入的文件移动到 /var/lib/mysql-files 目录下
选择数据库
执行
load data infile '/var/lib/mysql-files/test.csv'
into table `test`
fields terminated by ',' optionally enclosed by '"' escaped by '"' lines terminated by '\n';
由于mysql的配置,一般情况下,不允许从其他目录导入文件
需要将要导入的文件移动到 /var/lib/mysql-files 目录下
选择数据库
执行
load data infile '/var/lib/mysql-files/test.csv'
into table `test`
fields terminated by ',' optionally enclosed by '"' escaped by '"' lines terminated by '\n';