by Tom Millard

Connect Node mysql to your MAMP server on mac

Whilst working on a node application on my Mac book and I needed to connect up MySql.

I wanted to recycle my MAMP server, but had no luck with just smashing in the application login credentials.

Until I found http://getshao.com/.

socketPath : '/Applications/MAMP/tmp/mysql/mysql.sock'

all together we have something like this:

var mysql      = require('mysql');   
var connection = mysql.createConnection({  
  host     : 'localhost',
  user     : 'root',
  password : 'hello',
  database : 'database',
  post : 3306,
  socketPath : '/Applications/MAMP/tmp/mysql/mysql.sock',
});

And everything worked.