I tried installing mysql server a couple of times and I'm having problems. First of all, when I install it gives me a message that it's setting up and it just hangs. I can't ctl + c out of it, so I reboot the server and try to log into the db with
sudo mysql -u root -p
I enter my password and then get
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I restart the server:
$ sudo /etc/init.d/mysql start
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql start
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the start(8) utility, e.g. start mysql
I try this:
$ aptitude search mysql | grep ^i
i A libdbd-mysql-perl - Perl5 database interface to the MySQL data
i libmysql-java - Java database (JDBC) driver for MySQL
i A libmysqlclient16 - MySQL database client library
i mysql-client-5.1 - MySQL database client binaries
i A mysql-client-core-5.1 - MySQL database core client binaries
i mysql-common - MySQL database common files, e.g. /etc/mys
i mysql-embedded - MySQL - embedded library
i mysql-server-core-5.1 - MySQL database server binaries
When I navigate to the folder to see if the *.sock file exists:
'/var/run/mysqld/mysqld.sock'
it does not. I also try this:
$ service mysql status
status: Unable to connect to system bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
Any ideas? On my other machines installing mysql has been a snap, not sure what the problem is here.
You've corrupted your packages I see. You said you cancelled the installation of MySQL server, which is the package
mysql-server-5.1
.Try clearing your MySQL configuration and reinstalling it:
Note that the first command clears previous settings and passwords of the MySQL database including the MySQL database itself. If you've just installed the server (as I can make up from your question), this is not an issue.
As SpamapS noticed, you can use apt's purge feature to get rid of the MySQL server and its settings. The commands for purging and installing follows:
Does the file
mysqld.sock
exist? If not, try the following: