My MySQL installation is broken. How to completely reconfigure it?












20















Here are the following commands I have done.



$ sudo service mysql start
mysql start/running

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

$ aptitude search mysql |grep ^i
i libapache2-mod-auth-mysql - Module Apache 2 pour l'authentification vi
i libdbd-mysql-perl - Perl5 database interface to the MySQL data
i libmysqlclient16 - MySQL database client library
i mysql-client-5.1 - MySQL database client binaries
i mysql-client-core-5.1 - MySQL database core client binaries
i mysql-common - MySQL database common files, e.g. /etc/mys
i mysql-server-5.1 - MySQL database server binaries and system
i mysql-server-core-5.1 - MySQL database server binaries
i php5-mysql - MySQL module for php5









share|improve this question

























  • alm - find your mysql.log cat /var/log/mysql.log and edit your answer withthis file....

    – hhlp
    Oct 19 '11 at 19:47








  • 5





    I like the way you used grep ^i there. Pretty intelligent.

    – Luis Alvarado
    Oct 19 '11 at 20:25











  • What exactly does it do? aptitude is installation tools.

    – user4951
    Aug 7 '12 at 9:13











  • @JimThio That's to find the installed packages related to this question.

    – hexafraction
    Aug 14 '12 at 14:04
















20















Here are the following commands I have done.



$ sudo service mysql start
mysql start/running

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

$ aptitude search mysql |grep ^i
i libapache2-mod-auth-mysql - Module Apache 2 pour l'authentification vi
i libdbd-mysql-perl - Perl5 database interface to the MySQL data
i libmysqlclient16 - MySQL database client library
i mysql-client-5.1 - MySQL database client binaries
i mysql-client-core-5.1 - MySQL database core client binaries
i mysql-common - MySQL database common files, e.g. /etc/mys
i mysql-server-5.1 - MySQL database server binaries and system
i mysql-server-core-5.1 - MySQL database server binaries
i php5-mysql - MySQL module for php5









share|improve this question

























  • alm - find your mysql.log cat /var/log/mysql.log and edit your answer withthis file....

    – hhlp
    Oct 19 '11 at 19:47








  • 5





    I like the way you used grep ^i there. Pretty intelligent.

    – Luis Alvarado
    Oct 19 '11 at 20:25











  • What exactly does it do? aptitude is installation tools.

    – user4951
    Aug 7 '12 at 9:13











  • @JimThio That's to find the installed packages related to this question.

    – hexafraction
    Aug 14 '12 at 14:04














20












20








20


7






Here are the following commands I have done.



$ sudo service mysql start
mysql start/running

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

$ aptitude search mysql |grep ^i
i libapache2-mod-auth-mysql - Module Apache 2 pour l'authentification vi
i libdbd-mysql-perl - Perl5 database interface to the MySQL data
i libmysqlclient16 - MySQL database client library
i mysql-client-5.1 - MySQL database client binaries
i mysql-client-core-5.1 - MySQL database core client binaries
i mysql-common - MySQL database common files, e.g. /etc/mys
i mysql-server-5.1 - MySQL database server binaries and system
i mysql-server-core-5.1 - MySQL database server binaries
i php5-mysql - MySQL module for php5









share|improve this question
















Here are the following commands I have done.



$ sudo service mysql start
mysql start/running

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

$ aptitude search mysql |grep ^i
i libapache2-mod-auth-mysql - Module Apache 2 pour l'authentification vi
i libdbd-mysql-perl - Perl5 database interface to the MySQL data
i libmysqlclient16 - MySQL database client library
i mysql-client-5.1 - MySQL database client binaries
i mysql-client-core-5.1 - MySQL database core client binaries
i mysql-common - MySQL database common files, e.g. /etc/mys
i mysql-server-5.1 - MySQL database server binaries and system
i mysql-server-core-5.1 - MySQL database server binaries
i php5-mysql - MySQL module for php5






mysql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 19 '11 at 18:25









Nitin Venkatesh

16.3k116087




16.3k116087










asked Oct 19 '11 at 17:15









almalm

111116




111116













  • alm - find your mysql.log cat /var/log/mysql.log and edit your answer withthis file....

    – hhlp
    Oct 19 '11 at 19:47








  • 5





    I like the way you used grep ^i there. Pretty intelligent.

    – Luis Alvarado
    Oct 19 '11 at 20:25











  • What exactly does it do? aptitude is installation tools.

    – user4951
    Aug 7 '12 at 9:13











  • @JimThio That's to find the installed packages related to this question.

    – hexafraction
    Aug 14 '12 at 14:04



















  • alm - find your mysql.log cat /var/log/mysql.log and edit your answer withthis file....

    – hhlp
    Oct 19 '11 at 19:47








  • 5





    I like the way you used grep ^i there. Pretty intelligent.

    – Luis Alvarado
    Oct 19 '11 at 20:25











  • What exactly does it do? aptitude is installation tools.

    – user4951
    Aug 7 '12 at 9:13











  • @JimThio That's to find the installed packages related to this question.

    – hexafraction
    Aug 14 '12 at 14:04

















alm - find your mysql.log cat /var/log/mysql.log and edit your answer withthis file....

– hhlp
Oct 19 '11 at 19:47







alm - find your mysql.log cat /var/log/mysql.log and edit your answer withthis file....

– hhlp
Oct 19 '11 at 19:47






5




5





I like the way you used grep ^i there. Pretty intelligent.

– Luis Alvarado
Oct 19 '11 at 20:25





I like the way you used grep ^i there. Pretty intelligent.

– Luis Alvarado
Oct 19 '11 at 20:25













What exactly does it do? aptitude is installation tools.

– user4951
Aug 7 '12 at 9:13





What exactly does it do? aptitude is installation tools.

– user4951
Aug 7 '12 at 9:13













@JimThio That's to find the installed packages related to this question.

– hexafraction
Aug 14 '12 at 14:04





@JimThio That's to find the installed packages related to this question.

– hexafraction
Aug 14 '12 at 14:04










4 Answers
4






active

oldest

votes


















15














Before reinstalling check /var/log/mysql for logs files which may contain clues as to why mysql is not working. If there are no logs log to file might not be enabled in your configuration: Configure Mysql Error Log



To reinstall any package check installed version with



dpkg -l|grep mysql-server


then for version 5.7 use



sudo apt-get install mysql-server-5.7 --reinstall


If this doesn't allow you to reconfigure the package you can use



sudo dpkg-reconfigure mysql-server-5.7





share|improve this answer


























  • sudo dpkg-reconfigure mysql-server-5.1 did the trick for me when I upgraded from 11.10 to 12.04 i mysqld wouldn't start and i was forced to manually sudo mysqld

    – Hanynowsky
    Mar 14 '12 at 2:12



















7














ERROR 2002 (HY000): Can not connect to local MySQL server-through socket '/ tmp / mysql.sock' (2)



In MySQL installations can specify where we will have the socket for local connections. When making updates is not uncommon to see the error "Can not connect to local MySQL server socket-through." Let's see how to solve this problem.



The error look like this:



Mysql-u root-p
Enter password:
ERROR 2002 (HY000): Can not connect to local MySQL server-through socket '/ tmp / mysql.sock' (2)


thru ps we can see if is specified by parameter and the place where is it:



# ps -fea | grep mysqld
mysql 17661 14003 1 Feb19 ? 00:24:59 /usr/local/mysql-percona/libexec/mysqld --basedir=/usr/local/mysql-percona --datadir=/var/data/mysql/datadir/data --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log
root 23790 7840 0 09:25 pts/0 00:00:00 grep mysqld


In this case we see is in /var/lib/mysql/mysql.sock. If not found as a parameter should look into mysqld section of /etc/my.cnf to find the parameter:



grep socket /etc/my.cnf
socket=/var/lib/mysql/mysql.sock


If we know where is it we need to modify the same file (/etc/my.cnf) and add the parameter section socket client:



[client]
default-character-set=utf8
socket=/var/lib/mysql/mysql.sock





share|improve this answer





















  • 1





    That is what I was going to put as an answer. I already know this is the correct answer for almost all related problems like this. Will +1 you when I get the ability again.

    – Luis Alvarado
    Oct 19 '11 at 20:24











  • thanks for the thorough explanation! in my case even if i specified a socket in my.cnf it didn't listen on it (params shown in 'ps' are empty and no connection possible. workaround: add 'protocoll=tcp' to client section in my.cnf to force using tcp and not the socket.

    – Tapper
    Mar 31 '12 at 19:52



















2














For the latter viewers:

I came to the similar error when I failed to upgrade mysql-server package, but I found this solved my problem.
When sudo apt-get install -f doesn't work, try sudo apt-get purge mysql*. Now you can reinstall mysql-server.






share|improve this answer





















  • 1





    please note that sudo apt-get purge mysql wont preserve your databases

    – Nelson Owalo
    Jun 17 '17 at 11:08



















1














One of the problems I am running into is knowing which version I am having issues with.
This was a neat idea:



$ aptitude search mysql |grep ^i


But here's what I found was critical in the issue:



$ apt-get --reinstall install mysql-server-5.x


(where x is the version. If you don't add this, you could be working with the wrong dpkg.






share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f69380%2fmy-mysql-installation-is-broken-how-to-completely-reconfigure-it%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    15














    Before reinstalling check /var/log/mysql for logs files which may contain clues as to why mysql is not working. If there are no logs log to file might not be enabled in your configuration: Configure Mysql Error Log



    To reinstall any package check installed version with



    dpkg -l|grep mysql-server


    then for version 5.7 use



    sudo apt-get install mysql-server-5.7 --reinstall


    If this doesn't allow you to reconfigure the package you can use



    sudo dpkg-reconfigure mysql-server-5.7





    share|improve this answer


























    • sudo dpkg-reconfigure mysql-server-5.1 did the trick for me when I upgraded from 11.10 to 12.04 i mysqld wouldn't start and i was forced to manually sudo mysqld

      – Hanynowsky
      Mar 14 '12 at 2:12
















    15














    Before reinstalling check /var/log/mysql for logs files which may contain clues as to why mysql is not working. If there are no logs log to file might not be enabled in your configuration: Configure Mysql Error Log



    To reinstall any package check installed version with



    dpkg -l|grep mysql-server


    then for version 5.7 use



    sudo apt-get install mysql-server-5.7 --reinstall


    If this doesn't allow you to reconfigure the package you can use



    sudo dpkg-reconfigure mysql-server-5.7





    share|improve this answer


























    • sudo dpkg-reconfigure mysql-server-5.1 did the trick for me when I upgraded from 11.10 to 12.04 i mysqld wouldn't start and i was forced to manually sudo mysqld

      – Hanynowsky
      Mar 14 '12 at 2:12














    15












    15








    15







    Before reinstalling check /var/log/mysql for logs files which may contain clues as to why mysql is not working. If there are no logs log to file might not be enabled in your configuration: Configure Mysql Error Log



    To reinstall any package check installed version with



    dpkg -l|grep mysql-server


    then for version 5.7 use



    sudo apt-get install mysql-server-5.7 --reinstall


    If this doesn't allow you to reconfigure the package you can use



    sudo dpkg-reconfigure mysql-server-5.7





    share|improve this answer















    Before reinstalling check /var/log/mysql for logs files which may contain clues as to why mysql is not working. If there are no logs log to file might not be enabled in your configuration: Configure Mysql Error Log



    To reinstall any package check installed version with



    dpkg -l|grep mysql-server


    then for version 5.7 use



    sudo apt-get install mysql-server-5.7 --reinstall


    If this doesn't allow you to reconfigure the package you can use



    sudo dpkg-reconfigure mysql-server-5.7






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 2 at 9:46









    rubo77

    15.3k3197204




    15.3k3197204










    answered Oct 19 '11 at 19:15









    Ciaran LiedemanCiaran Liedeman

    1,359911




    1,359911













    • sudo dpkg-reconfigure mysql-server-5.1 did the trick for me when I upgraded from 11.10 to 12.04 i mysqld wouldn't start and i was forced to manually sudo mysqld

      – Hanynowsky
      Mar 14 '12 at 2:12



















    • sudo dpkg-reconfigure mysql-server-5.1 did the trick for me when I upgraded from 11.10 to 12.04 i mysqld wouldn't start and i was forced to manually sudo mysqld

      – Hanynowsky
      Mar 14 '12 at 2:12

















    sudo dpkg-reconfigure mysql-server-5.1 did the trick for me when I upgraded from 11.10 to 12.04 i mysqld wouldn't start and i was forced to manually sudo mysqld

    – Hanynowsky
    Mar 14 '12 at 2:12





    sudo dpkg-reconfigure mysql-server-5.1 did the trick for me when I upgraded from 11.10 to 12.04 i mysqld wouldn't start and i was forced to manually sudo mysqld

    – Hanynowsky
    Mar 14 '12 at 2:12













    7














    ERROR 2002 (HY000): Can not connect to local MySQL server-through socket '/ tmp / mysql.sock' (2)



    In MySQL installations can specify where we will have the socket for local connections. When making updates is not uncommon to see the error "Can not connect to local MySQL server socket-through." Let's see how to solve this problem.



    The error look like this:



    Mysql-u root-p
    Enter password:
    ERROR 2002 (HY000): Can not connect to local MySQL server-through socket '/ tmp / mysql.sock' (2)


    thru ps we can see if is specified by parameter and the place where is it:



    # ps -fea | grep mysqld
    mysql 17661 14003 1 Feb19 ? 00:24:59 /usr/local/mysql-percona/libexec/mysqld --basedir=/usr/local/mysql-percona --datadir=/var/data/mysql/datadir/data --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log
    root 23790 7840 0 09:25 pts/0 00:00:00 grep mysqld


    In this case we see is in /var/lib/mysql/mysql.sock. If not found as a parameter should look into mysqld section of /etc/my.cnf to find the parameter:



    grep socket /etc/my.cnf
    socket=/var/lib/mysql/mysql.sock


    If we know where is it we need to modify the same file (/etc/my.cnf) and add the parameter section socket client:



    [client]
    default-character-set=utf8
    socket=/var/lib/mysql/mysql.sock





    share|improve this answer





















    • 1





      That is what I was going to put as an answer. I already know this is the correct answer for almost all related problems like this. Will +1 you when I get the ability again.

      – Luis Alvarado
      Oct 19 '11 at 20:24











    • thanks for the thorough explanation! in my case even if i specified a socket in my.cnf it didn't listen on it (params shown in 'ps' are empty and no connection possible. workaround: add 'protocoll=tcp' to client section in my.cnf to force using tcp and not the socket.

      – Tapper
      Mar 31 '12 at 19:52
















    7














    ERROR 2002 (HY000): Can not connect to local MySQL server-through socket '/ tmp / mysql.sock' (2)



    In MySQL installations can specify where we will have the socket for local connections. When making updates is not uncommon to see the error "Can not connect to local MySQL server socket-through." Let's see how to solve this problem.



    The error look like this:



    Mysql-u root-p
    Enter password:
    ERROR 2002 (HY000): Can not connect to local MySQL server-through socket '/ tmp / mysql.sock' (2)


    thru ps we can see if is specified by parameter and the place where is it:



    # ps -fea | grep mysqld
    mysql 17661 14003 1 Feb19 ? 00:24:59 /usr/local/mysql-percona/libexec/mysqld --basedir=/usr/local/mysql-percona --datadir=/var/data/mysql/datadir/data --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log
    root 23790 7840 0 09:25 pts/0 00:00:00 grep mysqld


    In this case we see is in /var/lib/mysql/mysql.sock. If not found as a parameter should look into mysqld section of /etc/my.cnf to find the parameter:



    grep socket /etc/my.cnf
    socket=/var/lib/mysql/mysql.sock


    If we know where is it we need to modify the same file (/etc/my.cnf) and add the parameter section socket client:



    [client]
    default-character-set=utf8
    socket=/var/lib/mysql/mysql.sock





    share|improve this answer





















    • 1





      That is what I was going to put as an answer. I already know this is the correct answer for almost all related problems like this. Will +1 you when I get the ability again.

      – Luis Alvarado
      Oct 19 '11 at 20:24











    • thanks for the thorough explanation! in my case even if i specified a socket in my.cnf it didn't listen on it (params shown in 'ps' are empty and no connection possible. workaround: add 'protocoll=tcp' to client section in my.cnf to force using tcp and not the socket.

      – Tapper
      Mar 31 '12 at 19:52














    7












    7








    7







    ERROR 2002 (HY000): Can not connect to local MySQL server-through socket '/ tmp / mysql.sock' (2)



    In MySQL installations can specify where we will have the socket for local connections. When making updates is not uncommon to see the error "Can not connect to local MySQL server socket-through." Let's see how to solve this problem.



    The error look like this:



    Mysql-u root-p
    Enter password:
    ERROR 2002 (HY000): Can not connect to local MySQL server-through socket '/ tmp / mysql.sock' (2)


    thru ps we can see if is specified by parameter and the place where is it:



    # ps -fea | grep mysqld
    mysql 17661 14003 1 Feb19 ? 00:24:59 /usr/local/mysql-percona/libexec/mysqld --basedir=/usr/local/mysql-percona --datadir=/var/data/mysql/datadir/data --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log
    root 23790 7840 0 09:25 pts/0 00:00:00 grep mysqld


    In this case we see is in /var/lib/mysql/mysql.sock. If not found as a parameter should look into mysqld section of /etc/my.cnf to find the parameter:



    grep socket /etc/my.cnf
    socket=/var/lib/mysql/mysql.sock


    If we know where is it we need to modify the same file (/etc/my.cnf) and add the parameter section socket client:



    [client]
    default-character-set=utf8
    socket=/var/lib/mysql/mysql.sock





    share|improve this answer















    ERROR 2002 (HY000): Can not connect to local MySQL server-through socket '/ tmp / mysql.sock' (2)



    In MySQL installations can specify where we will have the socket for local connections. When making updates is not uncommon to see the error "Can not connect to local MySQL server socket-through." Let's see how to solve this problem.



    The error look like this:



    Mysql-u root-p
    Enter password:
    ERROR 2002 (HY000): Can not connect to local MySQL server-through socket '/ tmp / mysql.sock' (2)


    thru ps we can see if is specified by parameter and the place where is it:



    # ps -fea | grep mysqld
    mysql 17661 14003 1 Feb19 ? 00:24:59 /usr/local/mysql-percona/libexec/mysqld --basedir=/usr/local/mysql-percona --datadir=/var/data/mysql/datadir/data --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log
    root 23790 7840 0 09:25 pts/0 00:00:00 grep mysqld


    In this case we see is in /var/lib/mysql/mysql.sock. If not found as a parameter should look into mysqld section of /etc/my.cnf to find the parameter:



    grep socket /etc/my.cnf
    socket=/var/lib/mysql/mysql.sock


    If we know where is it we need to modify the same file (/etc/my.cnf) and add the parameter section socket client:



    [client]
    default-character-set=utf8
    socket=/var/lib/mysql/mysql.sock






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 28 '11 at 13:27

























    answered Oct 19 '11 at 19:59









    hhlphhlp

    32.8k1478131




    32.8k1478131








    • 1





      That is what I was going to put as an answer. I already know this is the correct answer for almost all related problems like this. Will +1 you when I get the ability again.

      – Luis Alvarado
      Oct 19 '11 at 20:24











    • thanks for the thorough explanation! in my case even if i specified a socket in my.cnf it didn't listen on it (params shown in 'ps' are empty and no connection possible. workaround: add 'protocoll=tcp' to client section in my.cnf to force using tcp and not the socket.

      – Tapper
      Mar 31 '12 at 19:52














    • 1





      That is what I was going to put as an answer. I already know this is the correct answer for almost all related problems like this. Will +1 you when I get the ability again.

      – Luis Alvarado
      Oct 19 '11 at 20:24











    • thanks for the thorough explanation! in my case even if i specified a socket in my.cnf it didn't listen on it (params shown in 'ps' are empty and no connection possible. workaround: add 'protocoll=tcp' to client section in my.cnf to force using tcp and not the socket.

      – Tapper
      Mar 31 '12 at 19:52








    1




    1





    That is what I was going to put as an answer. I already know this is the correct answer for almost all related problems like this. Will +1 you when I get the ability again.

    – Luis Alvarado
    Oct 19 '11 at 20:24





    That is what I was going to put as an answer. I already know this is the correct answer for almost all related problems like this. Will +1 you when I get the ability again.

    – Luis Alvarado
    Oct 19 '11 at 20:24













    thanks for the thorough explanation! in my case even if i specified a socket in my.cnf it didn't listen on it (params shown in 'ps' are empty and no connection possible. workaround: add 'protocoll=tcp' to client section in my.cnf to force using tcp and not the socket.

    – Tapper
    Mar 31 '12 at 19:52





    thanks for the thorough explanation! in my case even if i specified a socket in my.cnf it didn't listen on it (params shown in 'ps' are empty and no connection possible. workaround: add 'protocoll=tcp' to client section in my.cnf to force using tcp and not the socket.

    – Tapper
    Mar 31 '12 at 19:52











    2














    For the latter viewers:

    I came to the similar error when I failed to upgrade mysql-server package, but I found this solved my problem.
    When sudo apt-get install -f doesn't work, try sudo apt-get purge mysql*. Now you can reinstall mysql-server.






    share|improve this answer





















    • 1





      please note that sudo apt-get purge mysql wont preserve your databases

      – Nelson Owalo
      Jun 17 '17 at 11:08
















    2














    For the latter viewers:

    I came to the similar error when I failed to upgrade mysql-server package, but I found this solved my problem.
    When sudo apt-get install -f doesn't work, try sudo apt-get purge mysql*. Now you can reinstall mysql-server.






    share|improve this answer





















    • 1





      please note that sudo apt-get purge mysql wont preserve your databases

      – Nelson Owalo
      Jun 17 '17 at 11:08














    2












    2








    2







    For the latter viewers:

    I came to the similar error when I failed to upgrade mysql-server package, but I found this solved my problem.
    When sudo apt-get install -f doesn't work, try sudo apt-get purge mysql*. Now you can reinstall mysql-server.






    share|improve this answer















    For the latter viewers:

    I came to the similar error when I failed to upgrade mysql-server package, but I found this solved my problem.
    When sudo apt-get install -f doesn't work, try sudo apt-get purge mysql*. Now you can reinstall mysql-server.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 15 '16 at 13:09

























    answered Apr 15 '16 at 13:03









    artificerpiartificerpi

    19511




    19511








    • 1





      please note that sudo apt-get purge mysql wont preserve your databases

      – Nelson Owalo
      Jun 17 '17 at 11:08














    • 1





      please note that sudo apt-get purge mysql wont preserve your databases

      – Nelson Owalo
      Jun 17 '17 at 11:08








    1




    1





    please note that sudo apt-get purge mysql wont preserve your databases

    – Nelson Owalo
    Jun 17 '17 at 11:08





    please note that sudo apt-get purge mysql wont preserve your databases

    – Nelson Owalo
    Jun 17 '17 at 11:08











    1














    One of the problems I am running into is knowing which version I am having issues with.
    This was a neat idea:



    $ aptitude search mysql |grep ^i


    But here's what I found was critical in the issue:



    $ apt-get --reinstall install mysql-server-5.x


    (where x is the version. If you don't add this, you could be working with the wrong dpkg.






    share|improve this answer




























      1














      One of the problems I am running into is knowing which version I am having issues with.
      This was a neat idea:



      $ aptitude search mysql |grep ^i


      But here's what I found was critical in the issue:



      $ apt-get --reinstall install mysql-server-5.x


      (where x is the version. If you don't add this, you could be working with the wrong dpkg.






      share|improve this answer


























        1












        1








        1







        One of the problems I am running into is knowing which version I am having issues with.
        This was a neat idea:



        $ aptitude search mysql |grep ^i


        But here's what I found was critical in the issue:



        $ apt-get --reinstall install mysql-server-5.x


        (where x is the version. If you don't add this, you could be working with the wrong dpkg.






        share|improve this answer













        One of the problems I am running into is knowing which version I am having issues with.
        This was a neat idea:



        $ aptitude search mysql |grep ^i


        But here's what I found was critical in the issue:



        $ apt-get --reinstall install mysql-server-5.x


        (where x is the version. If you don't add this, you could be working with the wrong dpkg.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 31 '17 at 16:59









        NetsecNetsec

        313




        313






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f69380%2fmy-mysql-installation-is-broken-how-to-completely-reconfigure-it%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Mouse cursor on multiple screens with different PPI

            Agildo Ribeiro

            Sometime when accessing a menu: “Ubuntu 16.04 has experienced an internal error”