When the new environment is configured for PYCHARM projects, it is found that Pycharm cannot connect to the MySQL database. Because of the Java environment but have not configured the relevant library, and JetBrains home IDE is generally written in Java, so guess is Java is missing the driver of MySQL.
1. First make sure Python is connected to the database properly
Can be such as testing, if no error, indicating that the normal connection to the database
If there is an error, the MYSQLDB package may be missing
Download MySQLdb first.
You can install it in one step next.
2. Configuring the Java Environment
This step is a lot of online tutorials, also very simple, skip over
3. Configure Pycharm
First download MySQL Jdbcmysql-connector-java this is the official need to register the choice version, and so on, I will directly use my download to put in the Baidu Cloud:
Link:https://pan.baidu.com/s/1vAOfXNnKDUVE6tmYx6W93g Password:fmwj
Note the location of this file after decompression
Open the database plugin for pycharm and add a MySQL connection
Fill in the blanks.
Note that the driver you see at this point may not be the same as me, which means you need to do it.
Add and then look, so the problem solved some will let you update do not ask to ignore, directly can use the
Pycharm installing the MySQL driver package