Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

I tried installing MySQL using

sudo apt-get install mysql-server, and I get an error saying

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mysql-server : Depends: mysql-server-5.1 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

When I type sudo apt-get install mysql-server-5.1, it says:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mysql-server-5.1 : Depends: mysql-client-5.1 (>= 5.1.69-0ubuntu0.11.10.1) but it is not going to be installed
                    Depends: libdbi-perl but it is not going to be installed
E: Unable to correct problems, you have held broken packages."

And when I type mysql, it says,

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

I tried sudo apt-get remove --purge mysql-client-5.1 but it says that

mysql-client is not installed so it can't be uninstalled.

What should I do?

share|improve this question

marked as duplicate by Jorge Castro, souravc, Richard, Eric Carvalho, Luis Alvarado Mar 1 at 20:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Which Ubuntu release are you running? –  Mitch Mar 1 at 13:43
    
Edit your question and include the output of sudo apt-get check, cat /etc/apt/sources.list{,.d/*.list} and dpkg -l *mysql* –  Braiam Mar 1 at 14:06

1 Answer 1

And when I type "mysql", it says, "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)"

You can login to mysql database through

mysql -u root -p

and not mysql

While installation going you mus get prompted for password and you have to give that password here to login.

and to fix dep issue , you might try with

sudo apt-get install -f
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.