Note to self: Connecting MySQL with Django using Mamp in OSX

(February 14th, 2010)

Having trouble connecting your MAMP mysql database wth django?

Add the path DATABASE_HOST and connect it towards

{path to your MAMP directory}/tmp/mysql/mysql.sock

So my connection is for instance

DATABASE_HOST = ‘/Applications/MAMP/tmp/mysql/mysql.sock’

And the full mysql settings for for django

DATABASE_ENGINE = ‘mysql’ # ‘postgresql_psycopg2′, ‘postgresql’, ‘mysql’, ’sqlite3′ or ‘oracle’.
DATABASE_NAME = ‘mydb’ # Or path to database file if using sqlite3.
DATABASE_USER = ‘root’ # Not used with sqlite3.
DATABASE_PASSWORD = ‘root’ # Not used with sqlite3.
DATABASE_HOST = ‘localhost’ # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = ‘8888′ # Set to empty string for default. Not used with sqlite3.
DATABASE_HOST = ‘/Applications/MAMP/tmp/mysql/mysql.sock’

Its straightforward, but good to know, since adding the mysql.sock file in a folder named tmp seems a bit odd.

3 Responses to “Note to self: Connecting MySQL with Django using Mamp in OSX”

  1. Jeff Terry says:

    Thanks for the article. I am new at python and this got me straight.

  2. Dan Milas says:

    it was very helpful, thanks!

  3. Eddie says:

    Thanks for the article. It got me what I needed to find. I am learning django and was stuck on this for a bit.

Leave a Reply