vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| (also posted to alt.php.sql) This is an old problem. I extensively researched the postings on the internet and have found no solution. So, perhaps someone here can help. The problem is that from my index.php file I get: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' Now, when I do an ls -l '/var/lib/mysql/mysql.sock it shows that the daemon is running. It shows it there (size 0, as it should be). Furthermore, I can connect from command line and can do mysql commands. The mysql is on the same machine as the web server, so I use localhost as the host. php is running on the server as well. The ini file shows the default location of be empty, so it should default to the installation default of /var/lib/mysql/, and it does since it shows up with an ls. One post suggested changing ownership and group to mysql. I did that, but in reality that is how was originally anyhow. So, I am stumped. Are there any suggestions? Shelly |
| |||
| Shelly wrote: > (also posted to alt.php.sql) > > This is an old problem. I extensively researched the postings on the > internet and have found no solution. So, perhaps someone here can help. > > The problem is that from my index.php file I get: > > Can't connect to local MySQL server through socket > '/var/lib/mysql/mysql.sock' > > Now, when I do an ls -l '/var/lib/mysql/mysql.sock it shows that the > daemon > is running. It shows it there (size 0, as it should be). Furthermore, I > can connect from command line and can do mysql commands. The mysql is on > the same machine as the web server, so I use localhost as the host. php > is > running on the server as well. The ini file shows the default location of > be empty, so it should default to the installation default of > /var/lib/mysql/, and it does since it shows up with an ls. > > One post suggested changing ownership and group to mysql. I did that, but > in reality that is how was originally anyhow. > > So, I am stumped. Are there any suggestions? Login at the command line and enter 'status' and have a look at the 'UNIX socket:' line. I suspect it will be /tmp/mysql.sock, in which case you will have to tell php to use the correct socket or tell mysql to use the one in /var/lib/mysql -- Brian Wakem Email: http://homepage.ntlworld.com/b.wakem/myemail.png |
| |||
| "Brian Wakem" <no@email.com> wrote in message news:436d43F1lc3tcU1@individual.net... > Shelly wrote: > >> (also posted to alt.php.sql) >> >> This is an old problem. I extensively researched the postings on the >> internet and have found no solution. So, perhaps someone here can help. >> >> The problem is that from my index.php file I get: >> >> Can't connect to local MySQL server through socket >> '/var/lib/mysql/mysql.sock' >> >> Now, when I do an ls -l '/var/lib/mysql/mysql.sock it shows that the >> daemon >> is running. It shows it there (size 0, as it should be). Furthermore, I >> can connect from command line and can do mysql commands. The mysql is on >> the same machine as the web server, so I use localhost as the host. php >> is >> running on the server as well. The ini file shows the default location >> of >> be empty, so it should default to the installation default of >> /var/lib/mysql/, and it does since it shows up with an ls. >> >> One post suggested changing ownership and group to mysql. I did that, >> but >> in reality that is how was originally anyhow. >> >> So, I am stumped. Are there any suggestions? > > > Login at the command line and enter 'status' and have a look at the 'UNIX > socket:' line. I suspect it will be /tmp/mysql.sock, in which case you > will have to tell php to use the correct socket or tell mysql to use the > one in /var/lib/mysql It didn't understand "status". Shelly |
| |||
| Shelly wrote: > "Brian Wakem" <no@email.com> wrote in message > news:436d43F1lc3tcU1@individual.net... > >>Shelly wrote: >> >> >>>(also posted to alt.php.sql) >>> >>>This is an old problem. I extensively researched the postings on the >>>internet and have found no solution. So, perhaps someone here can help. >>> >>>The problem is that from my index.php file I get: >>> >>>Can't connect to local MySQL server through socket >>>'/var/lib/mysql/mysql.sock' >>> >>>Now, when I do an ls -l '/var/lib/mysql/mysql.sock it shows that the >>>daemon >>>is running. It shows it there (size 0, as it should be). Furthermore, I >>>can connect from command line and can do mysql commands. The mysql is on >>>the same machine as the web server, so I use localhost as the host. php >>>is >>>running on the server as well. The ini file shows the default location >>>of >>>be empty, so it should default to the installation default of >>>/var/lib/mysql/, and it does since it shows up with an ls. >>> >>>One post suggested changing ownership and group to mysql. I did that, >>>but >>>in reality that is how was originally anyhow. >>> >>>So, I am stumped. Are there any suggestions? >> >> >>Login at the command line and enter 'status' and have a look at the 'UNIX >>socket:' line. I suspect it will be /tmp/mysql.sock, in which case you >>will have to tell php to use the correct socket or tell mysql to use the >>one in /var/lib/mysql > > > It didn't understand "status". > > Shelly > > You did this from a mysql command prompt, right? -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
| |||
| "Brian Wakem" <no@email.com> wrote in message news:436d43F1lc3tcU1@individual.net... > Shelly wrote: >> The problem is that from my index.php file I get: >> >> Can't connect to local MySQL server through socket >> '/var/lib/mysql/mysql.sock' Make sure that socket file is readable/writeable by the uid that your Apache/PHP process runs under. Are you running SElinux (e.g. Redhat Enterprise Linux)? I have never been able to get MySQL to work while SElinux was enabled. Actually I'm surprised you got the daemon to run at all -- I have not been able to while SElinux was active. My solution was to turn off SElinux protection completely: # setenforce 0 I think there are also settings to disable SElinux enforcement per daemon (see section 5.2.8 of http://www.redhat.com/docs/manuals/e...tion-0068.html) Here's a thread from someone else who had the same 'socket' errors with MySQL and PHP, and disabling SElinux was their solution too: http://forums.devshed.com/mysql-help...et-203593.html Regards, Bill K. |
| Thread Tools | |
| Display Modes | |
|
|