- We connect to MySql Database by
mysql.connector.connect
. - With this, we connect to the database. We also have to put parameters in
.connect() function
<( host="localhost", user="root", passwd="your_password", database="your_database_name" )
>
A MySQL cursor is a database object that enables the end-user to retrieve, process, and scroll through rows of the result set one at a time.
mycursor = mydb.cursor()
This is how we specify the cursor of our database.
-
To create a database: <mycursor.execute("CREATE DATABASE STUDENTS")>
-
TO CREATE A TABLE in DATABASE