Configure php connection to mysql_MySQL in mac

Source: Internet
Author: User
Before configuring php to connect to mysql in mac, I used ubuntu to configure php to connect to mysql!
Swear that you will never try this kind of environment configuration again
I didn't expect a problem with mac!
The key is that I don't need php and apache from mac.
Brew yourself. The results tortured me for two nights ..
Php nginx is easy to integrate.
When php is connected to mysql
The error "mysql_connection () error No such file" is always prompted!
Google said that three parameters are inconsistent.
Use mysql root to log on to the STATUS to check the value of UNIX socket.
Change the value of mysql. default_socket, mysqli. default_socket, and pdo_mysql.default_socket in php. ini
The value of UNIX socket is the same.
But it is still difficult to make... This is the status until last night!
I came back from the street with my girlfriend this evening and went on to drum up ..
If this is not the case, the three parameters are not configured.
Check whether/var/mysql. sock does not exist in the corresponding directory .. Mom
So Google went down. Add mysql. sock by yourself

Mkdir/var/mysql
Ln-s/tmp/mysql. sock/var/mysql. sock

Php will find mysql under/var/mysql. sock (available in/etc/php. ini configuration file ). but there is no/var/mysqlz directory on our mac. mysql. the sock file is in/tmp/mysql. under sock. what should we do?
It's easy. we only need to use ln-s to generate a "soft connection" for/var/mysql/to the mysql. sock file.

So php can finally connect to mysql... Not easy!
One-click installation package for cross-platform nginx php mysql! Every time the environment is tossed, it is a kind of torment!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.