Mar-27-2018, 09:50 PM
Hello,,
I am not sure if I have started this topic in the right place, if not, please move it.
I have a problem with the connection between Python and the MySQL database. When debugging the code
If this is the essence of information, then the server I have placed on a virtual machine on which Debian9 is installed, while python 3 works on windows7.
I am not sure if I have started this topic in the right place, if not, please move it.
I have a problem with the connection between Python and the MySQL database. When debugging the code
import mysql.connector con = mysql.connector.connect(user='admin',password='admin123',host='127.0.0.1',port='3306',database='admin')
Traceback (most recent call last): File "C:\Users\Asus\Desktop\1.py", line 6, in <module> db = pymysql.connect("127.0.0.1","admin","admin123","admin" ) File "D:\Python33\lib\site-packages\pymysql\__init__.py", line 90, in Connect return Connection(*args, **kwargs) File "D:\Python33\lib\site-packages\pymysql\connections.py", line 699, in __init__ self.connect() File "D:\Python33\lib\site-packages\pymysql\connections.py", line 936, in connect self._request_authentication() File "D:\Python33\lib\site-packages\pymysql\connections.py", line 1156, in _request_authentication auth_packet = self._read_packet() File "D:\Python33\lib\site-packages\pymysql\connections.py", line 1018, in _read_packet packet.check_error() File "D:\Python33\lib\site-packages\pymysql\connections.py", line 384, in check_error err.raise_mysql_exception(self._data) File "D:\Python33\lib\site-packages\pymysql\err.py", line 107, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.OperationalError: (1045, "Access denied for user 'admin'@'localhost' (using password: YES)")I also tried importing pymysql and the effect was also the same
import pymysql db = pymysql.connect("127.0.0.1","admin","admin123","admin" ) cursor = db.cursor()
Traceback (most recent call last): File "C:\Users\Asus\Desktop\1.py", line 5, in <module> db = pymysql.connect("127.0.0.1","admin","admin123","admin" ) File "D:\Python33\lib\site-packages\pymysql\__init__.py", line 90, in Connect return Connection(*args, **kwargs) File "D:\Python33\lib\site-packages\pymysql\connections.py", line 699, in __init__ self.connect() File "D:\Python33\lib\site-packages\pymysql\connections.py", line 936, in connect self._request_authentication() File "D:\Python33\lib\site-packages\pymysql\connections.py", line 1156, in _request_authentication auth_packet = self._read_packet() File "D:\Python33\lib\site-packages\pymysql\connections.py", line 1018, in _read_packet packet.check_error() File "D:\Python33\lib\site-packages\pymysql\connections.py", line 384, in check_error err.raise_mysql_exception(self._data) File "D:\Python33\lib\site-packages\pymysql\err.py", line 107, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.OperationalError: (1045, "Access denied for user 'admin'@'localhost' (using password: YES)")The password and login match. Are you able to tell me something in the topic, I'm fighting the second day and I do not know what the problem may be? I will also swear that I am a layperson when it comes to python. I'm just learning it.
If this is the essence of information, then the server I have placed on a virtual machine on which Debian9 is installed, while python 3 works on windows7.