MySQL won't start or won't installed
- by Owen
Hi there,
I'm trying to get a local LAMP setup on my Ubuntu desktop. I'm successfully got PHP install but I'm having trouble with MySQL
If PHP tries to connet to MySQL I get this error:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /var/www/testing.php on line 3
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
If I try via command line I get much the same error:
owen@desktop:~$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13)
Weirdly "/var/run/mysqld" does not exist.
Running a whereis command I get the following:
owen@desktop:~$ whereis mysqld.sock
mysqld: /usr/sbin/mysqld /usr/share/man/man8/mysqld.8.gz
So is MySQL even installed? Well acording to dpkg
owen@desktop:~$ dpkg -l | grep mysql
ii  libapache2-mod-auth-mysql                                4.3.9-13ubuntu1                                   Apache 2 module for MySQL authentication
ii  libdbd-mysql-perl                                        4.016-1                                           Perl5 database interface to the MySQL database
ii  libmysqlclient15off                                      5.1.30really5.0.83-0ubuntu3                       MySQL database client library
ii  libmysqlclient16                                         5.1.49-1ubuntu8.1                                 MySQL database client library
ii  mysql-admin                                              5.0r14+openSUSE-2.1                               GUI tool for intuitive MySQL administration
ii  mysql-client-5.1                                         5.1.49-1ubuntu8.1                                 MySQL database client binaries
ii  mysql-client-core-5.1                                    5.1.49-1ubuntu8.1                                 MySQL database core client binaries
ii  mysql-common                                             5.1.49-1ubuntu8.1                                 MySQL database common files, e.g. /etc/mysql/my.cnf
ii  mysql-gui-tools-common                                   5.0r14+openSUSE-2.1                               Architecture independent files for MySQL GUI Tools
ii  mysql-query-browser                                      5.0r14+openSUSE-2.1                               Official GUI tool to query MySQL database
ii  mysql-server                                             5.1.49-1ubuntu8.1                                 MySQL database server (metapackage depending on the latest version)
ii  mysql-server-5.1                                         5.1.49-1ubuntu8.1                                 MySQL database server binaries and system database setup
ii  mysql-server-core-5.0                                    5.1.30really5.0.83-0ubuntu3                       MySQL database core server files
ii  mysql-server-core-5.1                                    5.1.49-1ubuntu8.1                                 MySQL database server binaries
ii  php5-mysql
Can someone please help I'm really confused as what to do next. I'm not a Linux expert at all most of these commands I've ran I found of diffrent blogs and help forums.