开发者

unable to locate the dump csv file from mysql

开发者 https://www.devze.com 2023-04-01 01:25 出处:网络
Consider this code: mysql> select *into outfile \'atmout12.csv\' fields terminated by \',\' optionally enclosed by \'\"\' lines terminated by \'\\n\' from atm_atm;

Consider this code:

mysql> select *  into outfile 'atmout12.csv' fields terminated by ',' optionally enclosed by '"' lines terminated by '\n' from atm_atm;
ERROR 1086 (HY000): File 'atmout12.csv' already exists

mysql> select *  into outfile 'atmout1.csv' fields term开发者_JAVA百科inated by ',' optionally enclosed by '"' lines terminated by '\n' from atm_atm;
Query OK, 2822 rows affected (0.02 sec)

I used the above snippet to convert a table data to a CSV file. As you can see the query ran fine, but I am unable to locate where the file is.

I do an ls in the folder and can't locate it. I am using Ubuntu 11.04


The file will be locate in your data directory.

example: datadir=/opt/data/db_name.

Inside the particular database (db_name) folder/dir will contain your .csv file.

OR else we can give the output file in particular location , to generate like that the user should have super privileges.

example : mysql > use db_name mysql> select * into outfile 'atmout1.csv' from atm_atm; or mysql> select * into outfile '/opt/example.csv' from atm_atm;

NOTE :above output file will be in db_name folder.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号