Mysql 報The MySQL server is running with the --secure-file-priv option so 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;
裡面肯定有預設設定的資料夾,
可以有兩種方案解決
1.把要上傳的檔案放到你設定的檔案目錄內,
- Disable 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\tab_load_data.txt" i
-> table tab_load_data;
ERROR 29 (HY000): File 'C:\loads\tab_load_data.txt (Errcode: 2 - No such file or directory)
## 此時 報無此目錄error, 不使用絕對路徑,把要上傳的檔案複製到資料庫對應data目錄,C:\MySQL\data\data_name\tab_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 | 男 | 江西 | 1 |
| 2 | 韓順平 | 男 | 四川 | 2 |
+----+-----------+------+-----------+------+
相關文章
- ERROR 1290:The MySQL server is running with the --secure-file-priv optionErrorMySqlServer
- Linux:ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannLinuxErrorMySqlServer
- MySQL 報錯 ERROR 1290 (HY000): running with the --secure-file-privMySqlError
- the --skip-grant-tables option so it cannot
- MySQL 報錯MySQL server syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT'MySqlServerMIT
- MySQL: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1MySql
- Percona MySQL 5.6 語句加鎖報錯"ERROR 1665 (HY000): Cannot execute statement"MySqlError
- ERROR 1290 (HY000): The MySQL server is running withErrorMySqlServer
- MySQL案例01:Last_SQL_Errno: 1755 Cannot execute the current event group in the parallel modeMySqlASTParallel
- Nagios監控mysql從庫報錯:libmysqlclient.so.18: cannot open shared object fileiOSMySqlIBMclientObject
- ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables optErrorMySqlServer
- 【MySQL】Server-id導致Slave_IO_Running: No主從複製故障MySqlServer
- 安裝Oracle報:libawt.so:libXP.so.6:cannot open shared objectOracleObject
- mysql 啟動報錯Can't connect to local MySQL server through socket '/data/mysql/mysql/mysql.sock'(111)MySqlServer
- Navicat連線centos裡mysql報錯Host is not allowed to connect to this MySQL serverCentOSMySqlServer
- sqlplus cannot execute binary fileSQL
- MySQL 5.7 PREPARE、EXECUTE、DEALLOCATE語句介紹MySql
- Xtrabackup備份報錯Failed to connect to MySQL serverAIMySqlServer
- MySQL 8.0.12 --secure-file-priv 資料匯出問題解決MySql
- oracle安裝報錯libawt.so:libXP.so.6:cannot open shared object fileOracleObject
- MySQL Insert資料量過大導致報錯 MySQL server has gone awayMySqlServerGo
- SpingBoot - Mybatis報錯:For artifact {com.mysql:mysql-connector-j:null:jar}: The version cannot be empty.bootMyBatisMySqlNullJAR
- 【MySQL】檢視MySQL Server引數方法MySqlServer
- MySQL Server Startup ScriptMySqlServer
- Nagios 裡面監控MySQL 監控事務夯住(RUNNING)報警通知iOSMySql
- 安裝MySQL5.7報錯:The action ‘Install’ for product ‘MySQL Server 5.7.19’ failed.MySqlServerAI
- cmakelist 原始碼生成so 檔案 orthanc mysql原始碼MySql
- MySQL 預處理語句prepare、execute、deallocate的使用MySql
- MySQL:Lost connection to MySQL server at 'readingMySqlServer
- mysql關於mysql.server的總結MySqlServer
- MySQL master and slave have equal MySQL server UUIDsMySqlASTServerUI
- MySQL報錯ERROR 2013 (HY000): Lost connection to MySQL server during queryMySqlErrorServer
- MySQL 5.5 關閉資料庫報錯"Can't connect to local MySQL server through socket"MySql資料庫Server
- libclntsh.so.11.1:cannot restore segment prot after reloc:Permission denied 報錯REST
- MySQL server has gone awayMySqlServerGo
- MySQL client server 協議MySqlclientServer協議
- Mysql修改server uuidMySqlServerUI
- Connecting to the MySQL ServerMySqlServer