In the development of Python, Pycharm is a very good IDE, the following this article is mainly to introduce you to the Pycharm connection MySQL database steps, the text through the graphic introduction of very detailed, for everyone has a certain reference value, the need for friends below to see it together.
Objective
When I recently configured the Pycharm project in the new environment, I found that pycharm could not 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. So the hands up, finally is successful, so the process to share out to everyone, the need for friends to learn together.
First, make sure Python can connect 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.
Official Download: MySQLdb
You can install it in one step next.
Second, configure the Java environment.
This step is a lot of online tutorials, also very simple, skip over
Third, configuration Pycharm
Download the MySQL JDBC Mysql-connector-java first
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, problem solved
Summarize
"Recommended"
1. Python Free video tutorial
2. Python Object-oriented video tutorial
3. Python Basic Primer manual