Error: Could not connect to MySQL Server!

Asked By 470 points N/A Posted on -
qa-featured

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.
SHARE
Best Answer by Ashley_bates
Best Answer
Best Answer
Answered By 0 points N/A #101335

Error: Could not connect to MySQL Server!

qa-featured

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!
Answered By 15 points N/A #101336

Error: Could not connect to MySQL Server!

qa-featured

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

Related Questions