import mysql.connector mydb = mysql.connector.connect( host="localhost", user="yourusername", password="yourpassword", port = 8888, #for Mamp users database='whatever db you want' ) print(mydb)