Solve xampp auto-start and mysql. sock Problems

Source: Internet
Author: User

After installing ubuntu for a long time, I never used it. during the National Day, I had to go over and configure some basic development environments. As soon as I got started, I felt like ubuntu, and I couldn't tell why. Xampp was installed to test the php test environment locally. The installation was extremely simple, but I found it was not started on its own. The solution is also simple. Run the following command to open the started resource file:

Copy codeThe Code is as follows: x @ zst :~ $ Cd/etc/init. d
X @ zst:/etc/init. d $ sudo gedit rc. local

Add a line of code to the Startup file:Copy codeThe Code is as follows:/opt/lampp start

In this way, xampp can be started on its own, and then another problem occurs. When I connect to mysql using a mysql client, the following error occurs:
Can't connect to local MySQL server through socket '/var/lib/mysql. sock'
Obviously, this is not the directory where xampp is installed. Its location should beCopy codeThe Code is as follows:/opt/lampp/var/mysql. sock

The method shown on the Internet is to connect two files. The command is as follows:Copy codeThe Code is as follows: sudo ln-s/opt/lampp/var/mysql. sock/var/run/mysqld. sock

As a result, I did. At that time, the problem was solved. when there was a drawback, this sock file was available only when mysql was connected, and it disappeared after being restarted, I had to manually connect once, so I took this command and added the command line after starting the xampp code according to the previous method to solve the problem.

In general, two lines of commands are added to rc. local:Copy codeThe Code is as follows:/opt/lampp start
Sudo ln-s/opt/lampp/var/mysql. sock/var/run/mysqld. sock

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.