Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
pip install mysql-connector-python
and then I made a file names "my.py" containing the following code
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="abc",
password="1234"
print(mydb)
and im getting the following error
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
I have already closed firewalls, I have tried on 127.0.0.1, my LAN is not on proxy settings, and im not able to run connect on either port 3306 or 33060 or 22.
Here's everything from MYSql Installer - Community that I have installed
–
–
Database is not running (as proposed by John).
Your database is not running directly on your pc but on a VM or docker image.
In that case, user shall not be bound to 'localhost' but to '%' that stands for 'any location'. This is because VMs and docker containers run in a separate environment, and 'localhost' users login is accepted from the host running the database only.
Obviously this introduces a security concern since that login will be accepted from any place (localhost, other PCs in private network and other PCs on the internet network).
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.