Asked By
Francis
470 points
N/A
Posted on - 05/19/2011
I have installed MAMP yesterday, and had it working great. Was very impressed. Then today I got to start working on a new template and I got the Error Message:Â
Error: Could not connect to MySQL server!Â
Â
I tried rebooting my machine but that did not work. I also tried changing the SQL Port to 3306 but that didn't work. In the error logs I get the following messages:Â
Â
051019 11:29:43 [Warning] One can only use the –user switch if running as rootÂ
051019 11:29:45 InnoDB: Started; log sequence number 0 43634Â
051019 11:29:45 [ERROR] Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't existÂ
051019 11:29:45 mysqld endedÂ
Â
I am running MAMP 1.0.1 on OS X 10.3.9, the Apache Server Light is green but the MySQL light is Red. Any help would be much appreciated!
Â
Thanks.
Error: Could not connect to MySQL Server!
Francis,
Uninstall it to your system and reinstall by doing a "clean install".
Â
1. Change your MySQL password. Remember to take note of the correct path:
Â
/Applications/MAMP/Library/bin/mysqladmin -u root -p password NEWPASSWORD.
Check if you are currently using the wrong path:
http://localhost:8888/MAMP/help.php):/Applications/MAMP/bin/mysql4/bin/mysqladmin -u root -p password NEWPASSWORD
Â
2. Open your text editor and write this code:
Â
/Applications/MAMP/bin/phpMyAdmin/config.inc.php
Â
3. At the start of the file type this line:
Â
$cfg['Servers'][$i]['password'] = 'root'; // MySQL password
Â
4. Remember to change the root password with the same password you will choose upon changing process.
Â
5. Edit this line:
Â
/Applications/MAMP/bin/mamp/index.php and make it: $link = @mysql_connect(':/Applications/MAMP/tmp/mysql/mysql.sock', 'root', 'root');
Â
6. Use the same password on the changing process
Â
7. All application details should be located at /Applications/MAMP/htdocs/
Â
8. Use the browser: http://localhost:8888/ when accessing your details.
Â
Thank you for posting!
Error: Could not connect to MySQL Server!
I will suggest some workarounds for you to counter that problem you are facing after this installation of MAMO.
-
First, you will need to check the index.php file which is under the /MAMP/bin/mamp/ directory folder. In case you find that it has some code for the MySQL connection username/password as root/root, then I will suggest that you change the default root password, which you will do by modifying the code in index.php to test MAMP.
-
Another workaround for that will be to do the following:
-
You will need to launch MAMP
-
And then you will go to Preferences
-
And from there choose Port.
-
You will need to change the MySQL port to 3306 and see if that will work for you.
Clair Charles