Home  >  Article  >  Backend Development  >  Graphical tutorial on connecting pycharm to mysql

Graphical tutorial on connecting pycharm to mysql

Y2J
Y2JOriginal
2018-05-24 13:44:063307browse

When conducting Python research and development, pycharm is a good IDE. The following article mainly introduces the steps of connecting to the mysql database in pycharm. The article introduces it in detail through pictures and texts, and it will be a certain reference for everyone. Value, friends in need come and take a look below.

Preface

Recently when configuring the pycharm project in a new environment, I found that pycharm could not connect to the mysql database. Since the java environment has been installed but the relevant libraries have not been configured, and the IDEs of jetbrains are generally written in java, I guess it may be that java lacks the driver of mysql. So I started to do it, and finally succeeded, so I will share the process with everyone, and friends who need it can learn together.

1. First, make sure that python can connect to the database normally.

You can test it as shown below. If no error is reported, it means the database is connected normally


If there is an error, it may be that the MySQLdb package is missing

Download MYSQLdb first

Official download: MySQLdb

Step by stepnextInstallationOkay

2. Configure the java environment

There are many online tutorials for this step and it is very simple. Skip it

3. Configure pycharm

First download the jdbc mysql-connector-java of mysql

After unzipping, pay attention to the location of this file

Open the database plug-in of pycharm, Add a MySQL connection

Fill in all the fields

Note that the Driver you see at this time may be different from mine, which means you need to continue doing

Read again after adding, solve the problem

Summary

【Related recommendations】

1. Python Free Video Tutorial

2. Python object-oriented video tutorial

##3. Python Basics Getting Started Manual

The above is the detailed content of Graphical tutorial on connecting pycharm to mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn