• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 375
  • Last Modified:

PHP MySql under Linux

I am extreme newbie for linux and received this error when I try to run MySql.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

On google, I found that this error can be removed by altering mysql.sock / my.cnf file. But I dont find those files anywhere! I dont know if I have installed MySql successfully!
3 Solutions
to know if you have mysql installed use
check the results and see if you have mysql in it
sangeethaAuthor Commented:
Ok, It seems my FedoraCore2 defaultly have the MySQL 3.23 package!, anyone know how to upgrade the version automatically?
I'd advice you to upgrade it following the official guidlines as described here :
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

also try to read this since the person is trying to do same as you :
sangeetha, is mysql started?
/usr/bin/safe_mysqld &

Is it running under root?
ls -la /usr/bin/safe_mysqld
sangeethaAuthor Commented:
I got this:
[root@localhost/localdomain root]# /usr/bin/safe_mysqld
touch: cannot touch `/var/lib/mysql/localhost/localdomain.err': No such file or directory
chown: cannot access `/var/lib/mysql/localhost/localdomain.err': No such file or directory
Starting mysqld daemon with databases from /var/lib/mysql
/usr/bin/safe_mysqld: line 311: /var/lib/mysql/localhost/localdomain.err: No such file or directory
/usr/bin/safe_mysqld: line 317: /var/lib/mysql/localhost/localdomain.err: No such file or directory
STOPPING server from pid file /var/lib/mysql/localhost/localdomain.pid
tee: /var/lib/mysql/localhost/localdomain.err: No such file or directory
050414 23:11:17  mysqld ended
tee: /var/lib/mysql/localhost/localdomain.err: No such file or directory

Will myssql will be uninstalled with this commands?

[root@localhost/localdomain root]# rpm -e MySQL-server-4.1.11-0
[root@localhost/localdomain root]# rpm -e MySQL-client-4.1.11-0

Any help is much appreciated!
if you have MySQL 3.23 then maybe something like : rpm -e MySQL-server-3.2.... would be more appropriate.
Independent of the version you are running you have a problem with the location where your mysql-socket is placed. PHP is looking in a different location than MySQL is putting the socket. This you can solve by pointing PHP to the right location (although I'm not sure how) or putting the MySQL-socket in the right location by starting mysql as follows:

/path/to/your/mysqld --socket=/var/lib/mysql/mysql.sock

Don't forget to put the right path there!

Good luck

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now