Hi Kaniz,
One way you could do this is to use the connector API and call its constructor as follows
import mysql.connector
sqlConnect = mysql.connector.connect(user='userName', password='password', host='127.0.0.1', database='databaseName')
You would also want to close the connection after you are done using it
sqlConnet.close()