PHP is not connected to MySQL but MySQL command line operation is a normal workaround

Source: Internet
Author: User
Tags socket mysql command line

This article mainly introduces the PHP connection is not MySQL but the MySQL command line operation of the normal solution, the need for friends can refer to the

Failure Status: PHP Web Connection MySQL failed, but at the command line through the MySQL command to log in and normal operation. Solution: 1. Login to MySQL at the command line, execute the following command: The code is as follows: Show variables like ' socket '; After execution, it will be similar to the following echo: The code reads: "Variable_name" "Value" "Socket" "/home/mysql/data/mysql.sock" 2, edit php.ini, find To the Mysql.default_socket configuration item, the default is generally null (using the sock path set when editing MySQL) to add the value to the "/home/mysql/data/mysql.sock" in the above Echo: The code is as follows:;  Default socket name for the local MySQL connects. If empty, uses the built-in; MySQL defaults. Mysql.default_socket =/home/mysql/data/mysql.sock 3, restart PHP.
Related Article

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.