Code Comments
Programming Forum and web based access to our favorite programming groups.On a freshly installed Fedora C3 (incl. webserver apache php mysql) i get the following problem when connecting to mysql through a browser (phpMyAdmin): : #2002 Can't connect to local MySQL server through socket /var/lib/mysql/mysql.sock On the website of MySQL this error is mentioned but I found no solution. In /var/log/messages the following log occurs : localhost kernel: audit(....): avc: denied {write}for pid=2458 exe=/usr/sbin/httpd name=mysql.sock dev=hda13 ... What I have tried : - mysql.sock is srwxrwxrwx, seems ok, but dont know what the s stands for - the dir /var/lib/mysql was drwxr-xr-x and I changed it to drwxrwxrwx : no effect - tried different version of phpMyAdmin : same error - installed my website and got the following error : No connection possible with database (in the next version I will improve the error-messages) - through commandline there is no problem in connecting to mysql (log in, create databases, inserts, deletes, uploading dumps, making dumps, ....) What is the solution or what else can I try ? thanx, Pugi!
Post Follow-up to this messagePugi! wrote: > On a freshly installed Fedora C3 (incl. webserver apache php mysql) i get > the following problem when connecting to mysql through a browser > (phpMyAdmin): > : > #2002 Can't connect to local MySQL server through socket > /var/lib/mysql/mysql.sock This kind of messages are common when people haven't started the mysql serve r. chkconfig --level 35 mysqld on /etc/init.d/mysqld start //Aho
Post Follow-up to this messageThe correct answer was : adjust settings SELinux for httpd/apache. "J.O. Aho" <user@example.net> schreef in bericht news:3034mnF2q4jc8U1@uni-berlin.de... > Pugi! wrote: > > This kind of messages are common when people haven't started the mysql > server. > > chkconfig --level 35 mysqld on > /etc/init.d/mysqld start > > > //Aho
Post Follow-up to this messagePugi! wrote: > The correct answer was : adjust settings SELinux for httpd/apache. How would that editing be done? I'm getting similar errors: rich@linux:~> mysql -u root --host=localhost; ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) rich@linux:~> mysql -u root --host=localhost ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) rich@linux:~> mysql -u root -h localhost; ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) rich@linux:~> mysql -uroot -hlocalhost; ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) rich@linux:~> mysql -uroot --host="localhost" ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) rich@linux:~> I should have no password yet since this is a brand new installation of Linux with Apache, MySQL, and PHP. The '/var/lib/mysql/' directory is empty. But if I put -p password I get prompted for a password, which is always wrong and sends me back to the command line.
Post Follow-up to this messageHi sorry for late reply. I only get the error message when connecting thru a browser, commandline worked fine for me. Here is the solution for my problem : I use Fedora Core 3 with SELinux (I had no idea what this was about, being newbie). To solve error 2002 cant connect to socket -problem Boot linux and log in as root. (I have installed dutch language instead of english and I translated names of menus as best as I could) From Startmenu select "System settings" Then choose "Security settings or security level" A window appears with 2 tabs : "Firewall options" and "SELinux" Choose SELinux. At the bottom half of the window you have a lisbox, listing (at least on my pc) Apache Name Service NIS Transition Open Transition Select "Disable SELinux protection for httpd daemon" Click "OK" I dont remember if I had to reboot to make it work Since I use Apache-PHP-MySQL to make website locally and later ftp it to a host, I dont need that much security. Some questions for your problem. Does the root user for mysql has a password ? If yes, I usually connect as mysql -u root -p and then I am prompted for password. I never specified the host. If in doubt, make 2 entries for root user in user-table,one with host = localhost and one with host=%. It is default when I install MySQL, maybe it is different in your installation. Pugi! "Richard Hollenbeck" <richard.hollenbeck@verizon.net> schreef in bericht news:4Iwnd.824$Nh1.504@trnddc09... > Pugi! wrote: > > > How would that editing be done? I'm getting similar errors: > > rich@linux:~> mysql -u root --host=localhost; > ERROR 2002: Can't connect to local MySQL server through socket > '/var/lib/mysql/mysql.sock' (2) > rich@linux:~> mysql -u root --host=localhost > ERROR 2002: Can't connect to local MySQL server through socket > '/var/lib/mysql/mysql.sock' (2) > rich@linux:~> mysql -u root -h localhost; > ERROR 2002: Can't connect to local MySQL server through socket > '/var/lib/mysql/mysql.sock' (2) > rich@linux:~> mysql -uroot -hlocalhost; > ERROR 2002: Can't connect to local MySQL server through socket > '/var/lib/mysql/mysql.sock' (2) > rich@linux:~> mysql -uroot --host="localhost" > ERROR 2002: Can't connect to local MySQL server through socket > '/var/lib/mysql/mysql.sock' (2) > rich@linux:~> > > I should have no password yet since this is a brand new installation of > Linux with Apache, MySQL, and PHP. The '/var/lib/mysql/' directory is > empty. But if I put -p password I get prompted for a password, which is > always wrong and sends me back to the command line. > >
Post Follow-up to this messageRich, I too am new at this and do not claim to be an expert. However, I was getting the same results that you were and have noticed the following: Is the MySQL Server running? When it is running I see this: [root@localhost ~]# ls -l /var/lib/mysql total 28 drwx------ 2 mysql mysql 4096 Nov 25 12:03 menagerie drwx------ 2 mysql mysql 4096 Nov 23 02:46 mysql srwxrwxrwx 1 mysql mysql 0 Nov 26 00:25 mysql.sock drwx------ 2 mysql mysql 4096 Nov 23 02:46 test [root@localhost ~]# When MySQL Server is NOT running it looks like this: [root@localhost ~]# ls -l /var/lib/mysql total 24 drwx------ 2 mysql mysql 4096 Nov 25 12:03 menagerie drwx------ 2 mysql mysql 4096 Nov 23 02:46 mysql drwx------ 2 mysql mysql 4096 Nov 23 02:46 test [root@localhost ~]# Notice the "mysql.sock" of size "0" with type "s" in the first view. This socket is only active when the MySQL Server is running. To get mine running I did the following (logged in remotely, not on the localhost): [root@localhost mysql]# mysql_install_db TO START MySQL SERVER: [root@localhost mysql]# /usr/bin/safe_mysqld TO STOP MySQL SERVER: [root@localhost ~]# mysqladmin shutdown -p Hope this helps, J R
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.