第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

MySQL - 本地加載數(shù)據(jù)

MySQL - 本地加載數(shù)據(jù)

哈士奇WWW 2023-03-22 10:58:19
在 Ubuntu (20.04) VPS 上運(yùn)行 MySQL (8.0) 數(shù)據(jù)庫。我當(dāng)前的目標(biāo)是嘗試通過 Python 腳本將 .CSV 文件自動(dòng)加載到表格中。該腳本在理論上是正確的并且應(yīng)該可以工作,它能夠?qū)?shù)據(jù)從 CSV 處理到表中。dbupdate.py:import mysql.connectorimport osimport stringdb = mysql.connector.connect (    host="localhost",    user="root",    passwd="********",    db="Rack_Info")sqlLoadData = "LOAD DATA LOCAL INFILE '/home/OSA_ADVA_Dashboard/Processed_CSV/DownloadedCSV.csv' INTO TABLE BerT FIELDS TERMINATED BY ',' ENCLOSED BY '*' IGNORE 1 LINES;"try:    curs = db.cursor()    curs.execute(sqlLoadData)    db.commit()    print ("SQL execution complete")    resultSet = curs.fetchall()except IOError:    print ("Error incurred: ")    db.rollback()    db.close()print ("Data loading complete.\n")我查閱了官方文檔并在服務(wù)器和客戶端上啟用了 local_infile,配置了 my.cnf 和 SQL。my.cnf 文件:## The MySQL database server configuration file.## You can copy this to one of:# - "/etc/mysql/my.cnf" to set global options,# - "~/.my.cnf" to set user-specific options.## One can use all long options that the program supports.# Run program with --help to get a list of available options and with# --print-defaults to see which it would actually understand and use.## For explanations see# http://dev.mysql.com/doc/mysql/en/server-system-variables.html## * IMPORTANT: Additional settings that can override those from this file!#   The files must end with '.cnf', otherwise they'll be ignored.#!includedir /etc/mysql/conf.d/!includedir /etc/mysql/mysql.conf.d/[client]local_infile=1[mysql]local_infile=1[mysqld]local_infile=1我已經(jīng)重新啟動(dòng)了 php 和 MySQL 服務(wù),但都無濟(jì)于事,服務(wù)器也是如此。不知所措。任何幫助將非常感激。
查看完整描述

2 回答

?
幕布斯6054654

TA貢獻(xiàn)1876條經(jīng)驗(yàn) 獲得超7個(gè)贊

我調(diào)查了 php.ini 文件并取消了加載數(shù)據(jù)行的注釋,但仍然沒有。

結(jié)果是 mysqld 的變量之一 secure_file_priv 指向一個(gè)空/默認(rèn)目錄。我所要做的就是將目錄更改為我的文件所在的位置。現(xiàn)在都在工作。


查看完整回答
反對(duì) 回復(fù) 2023-03-22
?
慕婉清6462132

TA貢獻(xiàn)1804條經(jīng)驗(yàn) 獲得超2個(gè)贊

如果我沒記錯(cuò)的話,php 有自己的配置文件,你必須在其中啟用加載數(shù)據(jù)本地 infile



查看完整回答
反對(duì) 回復(fù) 2023-03-22
  • 2 回答
  • 0 關(guān)注
  • 137 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)