In Red Hat As 4 + MySQL 5.0.37 + php 5.2 + apache. answer the sock file question. If you often encounter similar problems in actual operations, you 'd better not miss the following articles.
Environment: Red Hat As 4 + MySQL 5.0.37 + php 5.2 + apache
The first installation of MySQL in linux experienced a "torment", and it was always impossible to find/tmp/MySQL. the sock file is used to query information online, and the information is ln/var/lib/MySQL. sock/tmp/MySQL. sock, and modify/etc/my again. when php calls MySQL_connect (), a warning still appears, and ln does not work. Note: the preceding method basically finds at least one MySQL on the disk after MySQL is started. sock file, because MySQL. sock is generated after MySQL is started and does not exist if it is not started.
Due to multiple installation times, I may have started the MySQL process and re-compiled it, MySQL. sock disappears somehow, and a new MySQL is required. sock must be restarted from MySQL.) I don't know why, maybe it's too impatient. I Just reload it several times and finally connect to MySQL. no sock files can be found, and the solution is as follows:
1.
- #ps -aux|grep MySQL
Find the MySQL process.
# Kill MySQL process number
Confirm all kill light
2. Skip Step 1 directly. If this step is invalid, use step 2.
/Usr/local/MySQL/bin/MySQLd_safe -- user = MySQL & start MySQL.
Bin/MySQL-u root-p log on to MySQL
3.
Restart the MySQL service and run it in the directory where MySQL is installed.
- # service MySQLd start
4. I checked a bunch of information about apache and MySQL self-starting after linux restart, but it was useless. I came up with a simple method:
Add the following statement to the/etc/rc. d/rc. local file:
- /usr/local/apache/bin/apachectl start
- service MySQLd start
Both of them can start birds together with linux...
The above is directly started as a root user. There are many ln methods on the network, which I don't know yet. Try again later.
The above content is an introduction to the MySQL. sock file generated when MySQL is installed in linux. I hope you will get some benefits.