ilovecpp

shell命令

root@debian:~# mysqlimport -uroot -p123456 --fields-terminated-by=\',\' --fields-enclosed-by=\'"\' --fields-escaped-by=\'"\' database_name /var/lib/mysql-files/table_name.csv

参数说明:
–fields-terminated-by,字段间的分割符。
–fields-enclosed-by,单字段的前后分界限符。
–fields-escaped-by,转义字符。
database_name,库名。
table_name,即是文件名又是表名,必须一致。

常见问题

mysqlimport: Error: 1290, The MySQL server is running with the --secure-file-priv option so it cannot execute this statement, when using table: ...

MySQL启动参数–secure-file-priv,指定了一个目录,默认是/var/lib/mysql-files/,要导入的文件必须放在此目录下,否则在会出现如上错误。

分类:

技术点:

相关文章:

  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
  • 2021-11-21
  • 2021-08-01
  • 2022-12-23
猜你喜欢
  • 2021-05-16
  • 2021-11-20
  • 2021-11-20
  • 2022-02-08
  • 2021-07-28
  • 2021-07-05
  • 2021-06-22
相关资源
相似解决方案