当我尝试将Mysql DB导出为SELECT * INTO OUTFILE '/tmp/test.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM reviewdb1;
之类的CSV时
我收到错误
错误1046(3D000):未选择数据库
但是我正确地签署了reviewdb1。 所以我切换到reviewdb1
mysql> use reviewdb1
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> SELECT * INTO OUTFILE '/tmp/test.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM reviewdb1;
ERROR 1146 (42S02): Table 'reviewdb1.reviewdb1' doesn't exist
,在我的查询中似乎有问题(语法) 你能给我建议,到底是什么?
谢谢。
更新: 天亮了,我应该在要导出到.csv的数据库中对TABLE签名。
SELECT * FROM account_diff_preferences INTO OUTFILE '/var/lib/mysql-files/test.csv' FIELDS TERMINATED BY ',';
此命令可以正常工作,但是我可以像这样导出整个数据库,还是可以接受每个命令从数据库导出一个表?
答案 0 :(得分:0)
现在我意识到这是一个非常愚蠢的问题。 对不起。