RSS

Tag Archives: mysql

Make MAMP PRO not ask about passwords on service restart

Change your default MAMP password from ‘root’ to something more useful:
/Applications/MAMP/bin/mysql4/bin/mysqladmin -u root -p password newpassword

Edit the following files:

  • /Applications/MAMP/bin/phpMyAdmin-X.X.X/config.inc.php

    $cfg['Servers'][$i]['password'] = 'newpassword'; // change root to your new password

  • /Applications/MAMP/bin/mamp/index.php

    $link = @mysql_connect(’:/Applications/MAMP/tmp/mysql/mysql.sock’, ‘root’, ‘newpassword‘);

  • /Applications/MAMP/bin/stopMysql.sh

    # /bin/sh
    /Applications/MAMP/bin/mysql4/bin/mysqladmin -u root -pnewpassword –socket=/Applications/MAMP/tmp/mysql/mysql.sock shutdown

Tip taken from this site.

 
Leave a comment

Posted by on March 20, 2009 in Mac OS, Uncategorized

 

Tags: , , , ,

Coda books with custom images for Code Igniter, MySQL, PHP…

http://www.drastudio.com/past/2008/11/29/adding-more-coda-books/

 
1 Comment

Posted by on December 12, 2008 in Code Igniter, Uncategorized

 

Tags: , , ,

MAMP: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I instaled MAMP and it worked great. However, when I tried to access mysql from the shell I was getting

$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

However, using a full path to MAMP binary worked.
$ /Applications/MAMP/Library/bin/mysql -u root -p

MAMP’s mysql works with another socket file which is located at /Applications/MAMP/tmp/mysql/mysql.sock

All you have to do is:
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock

UPDATE: As it turns out the above soft link gets erased by the system, so you need to run the command every once in a while. At one point it got too frustrating so I figured out a permanent way to take care of this problem. Open /etc/my.cnf and add/edit these lines:
[mysqld]
socket=/Applications/MAMP/tmp/mysql/mysql.sock

[client]
socket=/Applications/MAMP/tmp/mysql/mysql.sock

Instead of telling MAMP which socket file to use, you are instructing the mysql client to use MAMP’s default socket.

Let me know if this works for you.

 
13 Comments

Posted by on November 26, 2008 in Mac OS

 

Tags: ,

 
%d bloggers like this: