rashidiwebseo

مشکل ارتباط با mysql /حتی ماژول mysql هم نصب است

rashidiwebseo ۱۳۹۸/۰۹/۰۲ زبان برنامه‌نویسی پایتون

دوستان با زدن کد زیر هنگام اجرا ارور میده

import mysql.connector mydb = mysql.connector.connect( host="localhost", user="yourusername", passwd="yourpassword" ) print(mydb)

این خطا میده

C:\Users\rashidi\AppData\Local\Programs\Python\Python38-32\python.exe D:/Total/proj/python/1.py Traceback (most recent call last): File "C:\Users\rashidi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mysql\connector\network.py", line 509, in open_connection self.sock.connect(sockaddr) ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:/Total/proj/python/1.py", line 3, in mydb = mysql.connector.connect( File "C:\Users\rashidi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mysql\connector\__init__.py", line 179, in connect return MySQLConnection(*args, **kwargs) File "C:\Users\rashidi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mysql\connector\connection.py", line 95, in __init__ self.connect(**kwargs) File "C:\Users\rashidi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mysql\connector\abstracts.py", line 716, in connect self._open_connection() File "C:\Users\rashidi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mysql\connector\connection.py", line 206, in _open_connection self._socket.open_connection() File "C:\Users\rashidi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\mysql\connector\network.py", line 511, in open_connection raise errors.InterfaceError( mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306' (10061 No connection could be made because the target machine actively refused it) Process finished with exit code 1

پاسخ‌ها به این تاپیک
javadrah
javadrah
۱۳۹۸/۰۹/۱۱

سلام

احتمال بالا پورت مای اسکیوال رو درست وارد نکردی، یا اینکه سرویسش استارت نیست!

موفق باشید