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