MAMP MySQL Cannot connect: invalid settings.

混江龙づ霸主 提交于 2020-06-11 08:45:59

问题


I've run into a issue in my MAMP instillation, I didn't change anything it just happened. I start MAMP perfectly fine and it gives the green light that the MySQL server is up and I can connect to it from the terminal using the mysql command. However when I try and open phpMyAdmin I get this error:

Error MySQL said: Documentation

Cannot connect: invalid settings. phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

I didn't change the default username and password and have subsequently tried to reset them to root and root which is what phpMyAdmin thinks they are. However I still get this error. The host is still set to localhost. I've tried uninstalling and reinstall MAMP to no avail.


回答1:


Seems like a lot of people where having this error recently.

MAMP had changed the PHP toggle in the preferences pane to 7.0.8, just had to switch it back to 5.6.10.




回答2:


You need to reset the mysql password for mamp.

I found that tech-otaku explains it well.---https://www.tech-otaku.com/local-server/resetting-mamp-mysql-root-user-password/

What he basically says in the link: Stop the servers. Then using the terminal:use the skip-grant-tables command, then --skip-networking command, and flush privileges command. He goes into more detail for the steps on his website.

P.S- You can also stop the mysqld server from the activity monitor. Applications/utilities/activitymoniter (search:mysql)




回答3:


Change these two lines in config.inc.php file.

$cfg['Servers'][$i]['host'] = '127.0.0.1';

$cfg['Servers'][$i]['port'] = '8889';

This should solve the problem.



来源:https://stackoverflow.com/questions/38352629/mamp-mysql-cannot-connect-invalid-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!