MySQLサーバーは--secure-file-privオプションを指定して実行されているため、この統計を実行できません...



Mysql Server Is Running With Secure File Priv Option It Cannot Execute This Stat



シーン:

mysql> load data infile 'C:data.txt' into tab_load_data ERROR 1290 (HY000): The MySQL server is on so it cannot execute this statement

トラブルシューティング:



mysql> select @@global.secure_file_priv

デフォルト設定のフォルダが必要です。
2つの方法で解決できます
1.アップロードするファイルを設定したファイルディレクトリに置きます。

  1. secure-file-privを無効にします。
    構成ファイルmy.iniを変更する必要があります。
#secure-file-priv='datadir='C:AppServ/MySQL/Uploads'

変更後にmysqlサービスを再起動します



mysql> select @@global.secure_file_priv +---------------------------+ | @@global.secure_file_priv | +---------------------------+ | NULL | +---------------------------+ 1 row in set (0.00 sec)

3、この時点でここを実行します

mysql> load data infile 'c:loads ab_load_data.txt' i -> table tab_load_data ERROR 29 (HY000): File 'C:loads ab_load_data.txt (Errcode: 2 - No such file or directory) ## At this time, there is no such directory error, no absolute path is used, and the file to be uploaded is copied to the corresponding data directory of the database, C:MySQLdatadata_name ab_load_data.txt > a mysql> load data infile 'tab_load_data.txt' int -> table tab_load_data Query OK, 6 rows affected, 1 warning (0.03 sec) Records: 6 Deleted: 0 Skipped: 0 Warnings: 1 mysql> select * from tab_load_data +----+-----------+------+-----------+------+ | id | name | sex | jiguan | f5 | +----+-----------+------+-----------+------+ | 1 | zhagnsan | Male | Jiangxi | 1 | | 2 | Han Shunping | Male | Sichuan | 2 | +----+-----------+------+-----------+------+