RDBMS is an application software for creating and managing relational databases. It makes possible for us to create, read, update and delete data from a database.
MySQL is a popular RDBMS software which use a client server model.
MySQL, is an open source relational database management system. It is based on the structure query language (SQL), which is used for adding, removing, and modifying information in the database.
Installation of MySQL:-
- Open the command prompt
- Type the following command.
- pip install MySQL -python
- Successfully install MySQL database.
You can easily import MySQL in python and use it.
We can create a new table by importing mysql.connector.
import mysql.connector db_connection = mysql.connector.connect ( host="hostname", user="root", password="pin", database="name_of_database" )
We have some function which has some specific work:-
- cursor.execute()- This is used to execute SQL queries.
- cursor.close()- It is used to close the cursor object.
- connection.close()- It is used to close MySQL database after the work is done
In this way we can connect python with MySQL.