8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MySQL(MariaDB)のSELECT文でcsvを出力した後のファイルパス

Posted at

Linux(CentOS7)でmariadbを使ってこんな感じでCSVファイルを出力する


SELECT bases_id, follower, get_date FROM twitter_status_histories where bases_id = 314 
INTO OUTFILE '/tmp/twitter_status_histories.csv'
  FIELDS TERMINATED BY ','

が /tmp にはファイルが作られない
そうなるとmysqlのデフォルトのファイルパスに作られてるはず・・ということでmy.cnfを見る

less /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql

ということでここにありそう

[hoge@localhost ~]$ ls -l /var/lib/mysql/twitter_status_histories.csv
-rw-rw-rw-. 1 mysql mysql 133875  3月 30 00:17 /var/lib/mysql/twitter_status_histories.csv

わかりにく!

8
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?