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.
  • List item

I've been looking all around the Internet for an answer but didn't find anything. I hope you can help me now.

I have a server with MySQL. From one day to another, MySQL didn't let me enter with my root password anymore (accsess denied for user 'root'@'localhost' using password: 'YES'). So I tried two ways to reset the password:

No.1: I typed:

    shell> /etc/init.d/mysqld stop

To stop MySQL. Then I restarted it skipping the grant-tables:

    shell> mysqld_safe --skip-grant-tables

So I was able to log in as root and change the password using:

    mysql> UPDATE mysql.user SET Password = PASSWORD('MyNewPassword') WHERE User = 'root';
    FLUSH PRIVILEGES;

I restarted MySQL and tried to log in as root with my new password - didn't work. So I tried the solution that's described here: http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html (I don't want to post it here because this post is already pretty long). Didn't work either. Actually it made it worse, because since that day, every time I try to start MySQL, it doesn't even ask me for my password, but I get:

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

Well, I've looked up what it means and found that my mysqld.sock is missing. I tried to create it using touch but MySQL can't start with that socket.

Now I'm trying to reinstall MySQL but everytime I type in

    shell> apt-get --purge remove mysql-server mysql-common mysql-client 

In that or any other order or every one of those three alone, I get:

    shell> Reading package lists... Done
    shell> Building dependency tree       
    shell> Reading state information... Done
    shell> Package mysql-client is not installed, so not removed
    shell> Package mysql-server is not installed, so not removed
    shell> You might want to run 'apt-get -f install' to correct these:
    shell> The following packages have unmet dependencies:
    shell>  libmysqlclient18 : Depends: mysql-common (>= 5.5.28-0ubuntu0.12.04.2) but it is not going to be installed
    shell>  libmysqlclient18:i386 : Depends: mysql-common:i386 (>= 5.5.28-0ubuntu0.12.04.2)
    shell>  mysql-client-5.5 : Depends: mysql-common (>= 5.5.28-0ubuntu0.12.04.2) but it is not going to be installed
    shell>  mysql-server-5.5 : PreDepends: mysql-common (>= 5.5.28-0ubuntu0.12.04.2) but it is not going to be installed
    shell>  psa-firewall : Depends: plesk-core (>= 11.0.9) but it is not installable
    shell>                 Depends: mysql-server but it is not going to be installed
    shell>  psa-spamassassin : Depends: plesk-core (>= 11.0.9) but it is not installable
    shell>  psa-vpn : Depends: plesk-core (>= 11.0.9) but it is not installable
    shell>            Depends: plesk-base (>= 11.0.9) but it is not installable
    shell>            Depends: mysql-server but it is not going to be installed
    shell> E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

So I said to my self "let's just remove those files with depenencies, too" (that psa-stuff since plesk is virtual and can't be uninstalled)... Guess what happened:

    shell> Reading package lists... Done
    shell> Building dependency tree       
    shell> Reading state information... Done
    shell> Package mysql-client is not installed, so not removed
    shell> Package mysql-server is not installed, so not removed
    shell> You might want to run 'apt-get -f install' to correct these:
    shell> The following packages have unmet dependencies:
    shell>  libmysqlclient18 : Depends: mysql-common (>= 5.5.28-0ubuntu0.12.04.2) but it is not going to be installed
    shell>  libmysqlclient18:i386 : Depends: mysql-common:i386 (>= 5.5.28-0ubuntu0.12.04.2)
    shell>  mysql-client-5.5 : Depends: mysql-common (>= 5.5.28-0ubuntu0.12.04.2) but it is not going to be installed
    shell>  mysql-server-5.5 : PreDepends: mysql-common (>= 5.5.28-0ubuntu0.12.04.2) but it is not going to be installed
    shell> E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Of course I tried apt-get -f install, too many times even.

What am I doing wrong? No matter, which other packages I include into apt-get --purge remove, I always get new dependencies. Do I have to delete every MySQL-related directory and file manually? Hope there's someone out there who can help me!

Cheers!

EDIT:

After trying apt-get purge mysql-server mysql-common mysql-client libmysqlclient18 libmysqlclient18:i386 mysql-client-5.5 mysql-server-5.5 psa-firewall psa-spamassassin psa-vpn

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Package mysql-client is not installed, so not removed
    Package mysql-server is not installed, so not removed
    You might want to run 'apt-get -f install' to correct these:
    The following packages have unmet dependencies:
     libdbd-mysql-perl : Depends: libmysqlclient18 (>= 5.5.13-1) but it is not going to be installed
     libmyodbc : Depends: libmysqlclient18 (>= 5.5.13-1) but it is not going to be installed
     libqt4-sql-mysql:i386 : Depends: libmysqlclient18:i386 (>= 5.5.13-1) but it is not going to be installed
     php5-mysql : Depends: libmysqlclient18 (>= 5.5.13-1) but it is not going to be installed
     ruby-mysql : Depends: libmysqlclient18 (>= 5.5.13-1) but it is not going to be installed
     E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

So I tried to remove all these and got:

    Building dependency tree       
    Reading state information... Done
    Package mysql-client is not installed, so not removed
    Package mysql-server is not installed, so not removed
    You might want to run 'apt-get -f install' to correct these:qlclient18:i386 mysql
    The following packages have unmet dependencies:
     libmysql-ruby1.8 : Depends: ruby-mysql but it is not going to be installed
    E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

S I tried removing that last file, too and was already looking forward to having my problem solved - but I got this:

    (Reading database ... 73213 files and directories currently installed.)
    Removing psa-imp ...
    dpkg action: 
     Trying to start service mysql... /usr/sbin/mysqld (pid 14824) is running...
    done
     Trying to establish test connection... ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

Where I got the last line quite many times. After that there was this:

    failed

    ERROR while trying to establish test connection
    Check the error reason(see log file: /tmp/plesk_11.0.9_installation.log), fix and try again

    dpkg action: 
     Trying to start service mysql... /usr/sbin/mysqld (pid 14824) is running...
    done
     Trying to establish test connection... ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

And of course my favourite line was there like a houndret times again The last line was just

E: Sub-process /usr/bin/dpkg returned an error code (1)

Any ideas?

share|improve this question

closed as too localized by jrg Dec 26 '12 at 1:38

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
What happens if you do: apt-get purge mysql-server mysql-common mysql-client libmysqlclient18 libmysqlclient18:i386 mysql-client-5.5 mysql-server-5.5 psa-firewall psa-spamassassin psa-vpn? –  Eric Carvalho Dec 4 '12 at 21:44
    
As I said, it return more dependencies and E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution). -.- –  Johannes Nielsen Dec 4 '12 at 21:46
    
Yeah, I'd like to know which packages are still broken after the above command, because it removes all the packages listed in error messages. –  Eric Carvalho Dec 4 '12 at 21:55
    
try running sudo apt-get autoremove - this should remove anything that depends on the removed packages; then try purge again –  jackweirdy Dec 5 '12 at 17:31
1  
Actually, I don't know :D it was just there. I reinstalled the whole server and now I can log in again phew ! Yet now I have another problem :D Maybe I'll ask another question for that. Thanks to everyone who tried to help me! (= –  Johannes Nielsen Dec 13 '12 at 15:34