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

零下一度
Release: 2017-04-27 09:48:58
Original
2282 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!