繁体   English   中英

在AIX 6上的python 3.5.1中连接到MySQL时出现分段错误

[英]Segmentation fault when Connect to MySQL in python 3.5.1 on AIX 6

我尝试执行以下任务:1编译Python 3.5.1源在AIX 6.0上使用GCC 4.2.0; 2使用Python 3.5.1做我的工作,包括连接和使用mysql databae; 一旦我尝试了此任务,就可以成功编译python 3.5.1源代码,并且除了连接和使用数据库外,还可以做得很好。


$/usr/local/bin/python3.5
Python 3.5.1 (default, Aug 12 2016, 15:48:31) 
[GCC 4.2.0] on aix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> dir(sys.path)
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']

然后我尝试安装PyMySQL-0.7.6在Linux和Windows上都运行良好,并且安装成功,但是不幸的是,当我尝试使用它来连接MySQL数据库时,出现了“分段错误(coredump)”错误并自动中止python;


>>> import pymysql
connection = pymysql.connect(host='150.17.31.113',user='sywu',password='sywu',db='sydb',charset='utf8mb4',cursorclass=pymysql.cursors.DictCursor);>>> connection = pymysql.connect(host='150.17.31.113',user='sywu',password='sywu',db='sydb',charset='utf8mb4',cursorclass=pymysql.cursors.DictCursor);
Segmentation fault(coredump)
$

一遍又一遍,它总是这样,我已经读过核心文件,它包含了不可读的内容,我不知道问题出在哪里,因为我不能用pymysql来做,所以我尝试安装mysql-connector-python 2.1.3,安装成功,但出现“非法指令(coredump)”错误,并自动中止python,


Type "help", "copyright", "credits" or "license" for more information.
>>> import mysql.connector
>>> cnx=mysql.connector.connect(user='sywu',password='sywu',host='150.17.31.113',database='sydb')
Illegal instruction(coredump)
$

有没有人在aix上成功做到这一点,有帮助吗?

我没有使用过AIX,但是从代码片段中,我可以从https://github.com/PyMySQL/PyMySQL/blob/master/example.py弄清楚,该参数是passwd而不是password

import pymysql

conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='', db='mysql')

另外,在同一个库中: https : //github.com/PyMySQL/PyMySQL ,查看示例。 可能可以帮助您。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM