Before connecting we download VS studio code, but to do that search visual C++ download on google.com visit support.microsoft.com and download the variant which is good for your PC.
VC use this link
My laptop is of 64 bit so I am downloading x64 : vc_redist.x64.exe file.
Once download the agreement page open just tick on agreement. click on install click yes to make change in drive. It will start installing the VS code. You will see below pop up to restart PC click on yes
Here installation complete. Now again lets go to google again and search “mysql community server download”
Click on mySQL
Click on go to download page or click on direct download, I will choose on go to download page, then you will come to two options like file with all package has large memory and file with low memory which will pull all packages while installing. After some two step accept process you will come to setup where choose server only option. Once done choose on execute option.
Once done it will install and while installing it will pull the packages from internet.
After installing server there are some configuration that you need to complete complete as per below.
And click on next then you reach to authentication method, select the default setting and proceed for accounts and role
Then you will open for asked for root password enter and proceed further for windows services
Change the name of service or you can proceed as default here I have changed name, and click on next
Now we need to download workbench just search MSSQL workbench on google workbench/
Click on download, and get installation process competed, just use all default terms and get it completed.
Once completion you will find server name there click on server
And below page opened
Now we just open your CMD prompt and write below line pip3 install mssql-connector-python as I did in below
And your connector download starts you can see the progress and completion note.
Setup of DB:
Open your SQL workbench and use some command from SQL language, but before that check build in DB for that use command show databases,
You can see the list of DB available, The yellow highlighted DB I created using create database name of DB in my case I run query create database my_test
Now connection for server with pycharm go in pycharm setting, project interpreter as mentioned below
Check mysql-connector-python is there tick and click on ok.
To connect DB my_test with python just import SQL connector package in python.
Now to check connection run below mentioned code.
If you get no error after running the above code then yes you connected to with SQL. To connect particular Database you can mention that name in mysql.connector.connect tool. As one more parameter.
Using Above method you can edit SQL query in workbench or in pycharm. to know the tool go through documentation on mssql connector