Back
Just download a Python library named "connector/python" by Oracle from here and there're no binaries to install.
Cheers......!!
For connecting Python to MySQL database these are the following steps you need to follow:-
The first thing is you need to install MySQL driver because Python needs this to access its database. For that you need to open your command prompt and write the following command:
python -m pip install mysql-connector
After completing the above-mentioned step you would have downloaded and installed MySQL in your system.
To check whether the installation is successful or not you need to test MySQL connector by using the following piece of code.
import mysql.connector
Now start creating connections to the database by using the username and password of the MySQL database that you would have set at the time of installation. Following is the code you can use:-
import mysql.connectormydb = mysql.connector.connect(host="localhost",user="yourusername",passwd="yourpassword")print(mydb)
mydb = mysql.connector.connect(
host="localhost",
user="yourusername",
passwd="yourpassword"
)
print(mydb)
You can use the following video tutorials to clear all your doubts:-
If you are looking for upskilling yourself in python you can join our Python Training and learn from the industry expert.
31k questions
32.8k answers
501 comments
693 users