How does pycharm connect to and configure the MySQL database?


Pycharm is a commonly used software developed in Python. When we use pycharm to make software, we often need to connect to MySQL database. So how to configure MySQL connection in pychar? Let’s take a look at the detailed configuration process.

Open connection page

First, we need to find the Database window in the page, which is generally on the right side of the page. If it is not displayed, you can click View – > tool windows – > database.

Then, after displaying the database, we clickDataBase。

Then we click the + sign of the database

Then selectData Source -> MySQL

Fill in relevant connection parameters

Then the connection page will be displayed. If it is the first connection, you need to click the download location below to download the jar package of the connected JDBC

Then wait for the jar package download to complete

Then we fill in the relevant parameters.

Host: refers to the IP address. If it is local, it is localhost.

User: user name,The default is root

Password: the password of the database

Database: the database in MySQL that needs to be connected

Port: port number,Default 3306

After filling in the relevant parameters,Click test connectio belown. Check whether it can be connected. For example, I have a connection timeout here

Then find a solution on the Internet,Just add it after the URL?serverTimezone=GMT

Finally, you can connect successfully

Using database

After the connection is successful, we can view the tables of the relevant database

And you can view the table data in the database

The above is pycharm’s skills for connecting to MySQL database. I hope you like it. Please continue to pay attention to developeppaer.

Relevant recommendations:

How does pycharm install third-party libraries? Pychart’s skills in installing Python Library

How does pycharm create associated files? Tips for creating Python files with pycharm