from http://groups.google.com/group/web2py/browse_thread/thread/80ebf55611335288?pli=1


Wow, I figured out how to make it work. In DAL.py I added the unix_socket 
 arg to the MySQLAdapter: 

        driver_args.update(dict(db=db, 
                                 user=credential_decoder(user), 
                                 passwd=credential_decoder(password), 
                                 host=host, 
                                 port=port, 
                                 charset=charset, 
                                 unix_socket='/tmp/mysql.sock')) 

And if you are on MAMP, the socket is actually located 
 at /Applications/MAMP/tmp/mysql/mysql.sock so you can either set to that or 
 put in a symbolic link. 

It does not appear that many people shared this problem but perhaps it 
 merits inclusion? Something like: 

db = DAL('mysql://user:password@localhost/test', 
 mysql_socket='/tmp/mysql.sock')