I am trying to connect MySQL to Pycharm.
With this code:
import mysql.connector
db = mysql.connector.connect(
host="localhost",
user="root",
passwd="password",
database="test"
But I got this: Process finished with exit code -1073741819 (0xC0000005)
What should I do?
I have done many things with the help of ChatGPT. But they didn’t work.
For example:
Windows
Open Windows Firewall:
Search for "Windows Defender Firewall with Advanced Security" in the Start menu and open it.
Create a New Inbound Rule:
In the left pane, select Inbound Rules.
In the right pane, click on New Rule….
Set Up the Rule:
Rule Type: Select Port and click Next.
Port: Choose TCP, and then specify 3306 in the Specific local ports field. Click Next.
Action: Select Allow the connection and click Next.
Profile: Choose the network profiles (Domain, Private, Public) where you want to allow this connection, then click Next.
Name: Give your rule a name like “MySQL Port 3306” and click Finish.
Restart MySQL Service:
After creating the rule, restart the MySQL service to apply changes.
2
Answers
Copied from another answer:
Try to run in non-debug mode.
The error code -1073741819 (0xC0000005) usually indicates a memory access violation.
Try to check mysql error logs, check pycharm configuration, temporarily disable firewall, update mysql connector.