Search code examples
pythonpycharmmysql-connector-python

How to connect to mysql in pycharm community edition?


I have a fresh install of pycharm community edition 2019.2 on mac 10.13.1

I want to connect to the mysql database I have locally.

I wrote a python file that starts

import mysql.connector

The 'mysql' part is underlined red, so I hover over it and get the message 'no module named mysql - install package mysql'

I click on the link and it says 'packages installed successfully - installed packages : mysql'

But the 'mysql' part of 'mysql.connector' remains red and it still says I haven't installed mysql.

What am I missing? Would hope this would be more intuitive.

Thanks!


Solution

  • You need to install mysql-connector-python (you can also install it from project interpreter).