How do I get MySQL working?

I'm in chapter 16 of the book _Agile Web Development with Rails_. I was able to get Apache/Passenger working, but now I'm stuck on MySQL. When I enter "mysql -u root", I get the message: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

I created the /var/run/mysqld directory and the /var/run/mysqld/ mysqld.sock file. However, I was not able to grant ownership of this file to mysql, because the user mysql doesn't exist.

What exactly do I need to do?

Hi Jason,

Is your MySQL service running? (/etc/init.d/mysql start or ‘service mysql start’)

If all else fails, you may want to consider uninstalling and reinstalling your mysql package with your distro’s package manager.

David

/etc/init.d/mysql doesn't exist, and 'service mysql start' gives me the error message "mysql: unrecognized service".

I'm using Ubuntu 11.04 as my OS. What packages do I need installed? I already have mysql-client-core-5.1 and mysql-common.

You are missing the obvious:

$ sudo apt-get install mysql-server

:smiley:

HTH Norbert

Actually i installed mysql-workbench on ubuntu, unable to start mysql. Whenever i type service mysql start or service mysqld start, i get " mysql is unrecognized command".

akash d. wrote in post #1128893:

Actually i installed mysql-workbench on ubuntu, unable to start mysql. Whenever i type service mysql start or service mysqld start, i get " mysql is unrecognized command".

Actually it means that mysql server is not installed try to re-install it by this command: sudo apt-get install mysql-server

i did that and my problem resolved, :slight_smile:

Regards, -Akash

Jason Hsu, Mr. Swift Linux wrote in post #1024613:

/etc/init.d/mysql doesn't exist, and 'service mysql start' gives me the error message "mysql: unrecognized service".

I'm using Ubuntu 11.04 as my OS. What packages do I need installed? I already have mysql-client-core-5.1 and mysql-common.

It means that mysql server is not installed. Try to re-install it by this command: sudo apt-get install mysql-server

And start mysql server: service mysql start

This will resolve your problem.. :slight_smile: