- ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
只需在load data 后面加上local就好了
- ERROR 2068 (HY000): LOAD DATA LOCAL INFILE file request rejected due to restrictions on access.
mysql -uroot -proot dbname --local-infile=1
- ModuleNotFoundError: No module named 'MySQLdb'
1、直接yum安装yum install MySQL-python -y
- -bash: unzip: command not found
yum install -y unzip zip
- 使用yum安装软件时报错
2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit)
2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit)
环境:CentOS 7.3,使用阿里yum的网络源
重点关注:libmysqlclient.so.18()(64bit)
原因:缺少Percona-XtraDB-Cluster-shared-55-5.5.37-25.10.756.el6.x86_64.rpm这个包
解决:
wget http://www.percona.com/redir/downloads/Percona-XtraDB-Cluster/5.5.37-25.10/RPM/rhel6/x86_64/Percona-XtraDB-Cluster-shared-55-5.5.37-25.10.756.el6.x86_64.rpm
# rpm -ivh Percona-XtraDB-Cluster-shared-55-5.5.37-25.10.756.el6.x86_64.rpm
2、python3虚拟环境下安装mysql-python模块时总是提示错误:
ModuleNotFoundError: No module named 'ConfigParser'
发现是python3版本没有mysql-python模块,是用pymysql模块代替了,因此安装mysql-python实际上就是安装pymysql模块即可。
pip install pymysql
查看安装列表:
pip3 list;
代码如下:(有效)
import pymysql
pymysql.install_as_MySQLdb()
def Mysql_connect():
db =pymysql.connect (host="127.0.0.1",user="root",passwd="root",db="***",local_infile = 1) return db
def Load_file(file_name):
Load_open = """set global local_infile='ON';"""
try:
db=Mysql_connect()
curs = db.cursor()
curs.execute(Load_open)
curs.execute(sqlLoadData)
db.commit()
print("SQL execution complete")
except Exception as e:
print("Error incurred:", e)
db.rollback()
finally:
db.close()