0
I’m having trouble connecting to mysql.connector.. In php myadmin, connects normal, and also bash is entering normal in mysql.. Only python gives this problem..
mydb=mysql.connector.connect(host='localhost',database='disc',user='root',password='12345678', use_unicode=True, charset='utf8')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/site-packages/mysql/connector/__init__.py", line 179, in connect
return MySQLConnection(*args, **kwargs)
File "/usr/lib64/python2.7/site-packages/mysql/connector/connection.py", line 95, in __init__
self.connect(**kwargs)
File "/usr/lib64/python2.7/site-packages/mysql/connector/abstracts.py", line 716, in connect
self._open_connection()
File "/usr/lib64/python2.7/site-packages/mysql/connector/connection.py", line 206, in _open_connection
self._socket.open_connection()
File "/usr/lib64/python2.7/site-packages/mysql/connector/network.py", line 512, in open_connection
errno=2003, values=(self.get_address(), _strioerror(err)))
Does anyone know what it can be?
what version of your python?
– Davi Wesley
version 2.7 ....
– Tsubasa Arihara
consider using the latest version of python since python2.7 will no longer be supported later this year
– Davi Wesley
I have tried to readapt my code to python3 but found many problems : ( I will use python2.7 while giving
– Tsubasa Arihara
more detail about the implementation you used and also the error
– Davi Wesley
Look, from what I’ve analyzed so far the problem seems to be in mysql, for some reason it doesn’t want to connect via tcp
– Tsubasa Arihara
I was told that it may be that phpmyadmin connects via socket, and python connects via tcp, so it is not connecting
– Tsubasa Arihara
I was able to solve, just uncomment the line in the mysql service script, the line SKIP="-Skip-networking" it is enabled by default in Slackware : ( I didn’t know that
– Tsubasa Arihara
Very good, mark your answer as resolved to finalize your question ;)
– Davi Wesley