MySQL and MAMP Command Line Question

I have the latest version of MySQL installed on my Mac. It works great. Recently, I've decided to give MAMP a try.

My installation of MAMP appears to be working fine.

I'd like to change my root password for the MySQL install running under MAMP. As I understand it, this must be done from the command line. However, I'm having trouble doing this because my bash shell tries to apply the commands I enter to my non-MAMP install of MySQL.

I've tried to reconfigure my environment variables for my PATH in both my .profile and .bash_login files, but this isn't fixing the problem. For example, I've applied the following line to my .bash_login file:

export PATH="/Applications/MAMP/Library/bin:/usr/local/bin:/usr/local/sbin:
/usr/local/mysql/bin:$PATH"

Here I've added the path to my MAMP bin directory (where mysqladmin is found) before anything else ... however, I get the error message:

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

Which, of course, means that my command is being applied to my non-MAMP install of MySQL.

I'm not sure how to get around this ... can someone help me out?

Thanks.

Eight-Core Mac Pro (3 GHz 2x Quad-Core Intel Xeon), Mac OS X (10.5.5), 5GB 667 MHz DDR2 RAM, 2.5 TB RAID 0, 2x Superdrives

Posted on Jul 12, 2009 11:21 PM

Reply
2 replies

Jul 14, 2009 10:18 AM in response to Rob Frei

From:

http://www.mamp.info/en/documentation/faq.html#q9



How can I change the password of the MySQL root user?

Open the MacOS Terminal Application (located in "/Applications/Utilities") and enter the following command line:


/Applications/MAMP/Library/bin/mysqladmin -u root -p password <NEWPASSWORD>


replace <NEWPASSWORD> with your new password.
Please bear in mind that you also have to change the phpMyAdmin configuration and probably your own php-scripts to use the newly created MySQL password. For changing the phpMyAdmin configuration edit the following file and update the password:


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

Jul 14, 2009 6:31 PM in response to micp

Yes, this same information is also included with MAMP.

As I explained above, my problem is different. I can't access mysqladmin for MAMP's install of MySQL.

For example, if I enter the following command:

/Applications/MAMP/Library/bin/mysqladmin version

the terminal yields:

/Applications/MAMP/Library/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/private/tmp/mysql.socket' (2)'
Check that mysqld is running and that the socket: '/private/tmp/mysql.socket' exists!

This indicates that bash is trying to run the mysqladmin command using my non-MAMP install of MySQL. If I launch MySQL, sudo -b mysqld_safe, and issue the command again, I get the expected response:

/applications/mamp/library/bin/mysqladmin Ver 8.41 Distrib 5.0.41, for apple-darwin8.11.1 on i686
Copyright (C) 2000-2006 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version 5.0.83-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /private/tmp/mysql.socket
Uptime: 46 sec

Threads: 1 Questions: 1 Slow queries: 0 Opens: 12 Flush tables: 1 Open tables: 6 Queries per second avg: 0.022

I'd like to issue these mysqladmin commands to the MySQL installed in MAMP. I'm just not clear on how to set up my environment to do so. Everything points to my MySQL install on OS X.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

MySQL and MAMP Command Line Question

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.