Home  >  Article  >  Database  >  What should I do if the database service cannot be connected when PHP connects to MAMP?

What should I do if the database service cannot be connected when PHP connects to MAMP?

零下一度
零下一度Original
2017-04-27 09:48:582381browse

1. Introduction to the problem

When using MAMP as a server to develop a PHP database application, the database service cannot be connected. Even using Navicat, the following error occurs


2. Solution

2.1 Navicat connection problem

In Navicat's connection properties, go to Advanced, check "Use socket file", and change /Applications/ MAMP/tmp/mysql/mysql.sock Copy it in


##2.2 Solve the failure problem of PHP connecting to MySql in MAMP

Execute in the terminal

sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock



The above is the detailed content of What should I do if the database service cannot be connected when PHP connects to MAMP?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn