I've just started programming Django in the PyCharm editor. I would like to setup a connection to a mysql-server on the Internet. So I clicked on Data Sources
> DB Data Source
.
Here's where the horror starts. I've to pick a JDBC Driver File
, I don't know which one I need to choose, I suppose MySQL Connector
. After that I need to pick a JDBC Driver Class
, just guessing but I would take the com.mysql.jdbc.Driver
. In addition I've to specify a Database URL
beginning with jdbc://
. I've never heard of JDBC and all that stuff.
Would be great if you could help me out here!
Go to Data Sources and Drivers and press + button.
From Drivers list select MySQL.
If you are doing this for the first time a 'Download missing drivers files' will appear at the bottom of the window. If you click it, it will download the latest driver for this connection.
You can also click on the Driver: MySQL link > Go to Driver and go to drivers config page. JDBC Driver Class should be set to com.mysql.cj.jdbc.Driver
by default. You can install older versions of drivers by clicking + button.
On Project Data Sources page fill in Host (IP or hostname), port (3306 by default), User and Password. Filling Databese is optional.
URL for connection should be jdbc:mysql://localhost:3306
or jdbc:mysql://localhost:3306/dbname
if you specified database name.
Documentation: https://www.jetbrains.com/help/pycharm/data-sources-and-drivers-dialog.html
Here is Data Sources and Drivers window from PyCharm 2019.2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With