You have to install it first through PIP.
pip install mysql-connector-python
Then you can use this in your code
from mysql.connector
Find more here:
https://pypi.org/project/mysql-connector-python/
https://dev.mysql.com/doc/connector-python/en/connector-python-introduction.html
Answer from jwill on Stack Overflowhow to install mysql connector to work with visual studio - Stack Overflow
Como instalar mysqlconnector en visual studio?
How to set up MySQL db connection to VS studio 2022? (c#)
sql - How to connect to MySQL server from Visual Studio Code - Stack Overflow
Hola estaba haciendo un programa en java el cual debe conectarse a una base de datos, ya hice el codigo, pero necesito usar la libreria o driver mysql-connector-java-5.1.46, ya lo descargue, y lo guarde dentro de una carpeta, el proceso para usar este driver en netbeans es agregando este driver al paquete, pero yo no uso netbeans, uso visual studio , y visual no tiene esa opción de hecho no usa paquetes, entonces como puedo usar esta libreria si trabajo con visual?
I can’t figure this out. I’ve seen two tutorials, none of which worked for me. Let me list what I’ve tried.
-
Downloaded the connector for NET
-
Add MySQL.Data from Nuget
-
Downloaded the deprecated mysql for vsstudio
Every time I go to data source though, MySQL isn’t there! It seems like it’s deprecated though. Can someone enlighten me how to connect?
I also have a database all ready for using, but I don’t know how to actually get it connected in my connection string. New guy problem but I put localhost, etc. Am I making the connection string wrong perhaps?
Couldn’t find too much help online other than get the right connection string, but I don’t even know if I did it right …
When you install the plugin vscode-database you have some buttons in the footer menu bar to connect to your database. When you open the plugin there is a short tutorial how to connect.
https://marketplace.visualstudio.com/items?itemName=bajdzis.vscode-database
Use this extension. I tried many of them but they didn't seem to connect.
- Make sure you first have downloaded MySQL Community Server on your machine.
- Then go ahead and temporarily download Workbench just to easily get the credentials for your connection.
- Then use this cweijan.vscode-mysql-client2 extension!
Hope this helps