Python MySQL Connection with MAMP | macOS

Here are how I connected to phpMyAdmin – MySQL Database

mysql = MySQL()
mysql.init_app(app)

# =====================

import mysql.connector

mydb = mysql.connector.connect(
  host="localhost:8889",
	unix_socket='/Applications/MAMP/tmp/mysql/mysql.sock',
  user="safa",
  passwd="safa",
  database="safa_task_project"
)


Leave a Reply

Your email address will not be published. Required fields are marked *