Hello, my mysql got replaced with mariadb, trying to install mysql-server gives me that:

root@BananasOnFire:~# sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package mysql-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  mariadb-server-10.2:i386 mariadb-server-10.2

E: Package 'mysql-server' has no installation candidate
root@BananasOnFire:~#

going to: bananasonfire.tk/phpmyadmin says:

Not Found
The requested URL /phpmyadmin was not found on this server.

Apache/2.4.18 (Ubuntu) Server at bananasonfire.tk Port 80

I lost all my databases :(

2 comments
  • I lost my databases too

  • I have just realised in 2020 that this has happened to me. Suddenly, I couldn’t log in to mysql and I couldn’t restart or reinstall despite trying all kinds of advice. I was relieved, but also extremely irritated that this command fixed everything:
    sudo apt reinstall mariadb-server
    I never installed maria-db. I had never heard of it until yesterday and yet it turns out I’m running maria-db not mysql. And yet this command:
    sudo service mysql start
    successfully restarted mysql…or is it maria-db? It’s bewildering!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

May i know which distro/version is running?

Try to search for the package using apt-cache and install.

$sudo apt-cache search mysql | grep mysql-server

  • version: Ubuntu 16.04 x64

    $ sudo apt-cache search mysql | grep mysql-server

    gives me that:

    root@BananasOnFire:~# sudo apt-cache search mysql | grep mysql-server
    mysql-server - MySQL database server (metapackage depending on the latest version)
    mysql-server-5.7 - MySQL database server binaries and system database setup
    mysql-server-core-5.7 - MySQL database server binaries
    mysql-server-5.6 - MySQL database server binaries and system database setup
    mysql-server-core-5.6 - MySQL database server binaries
    root@BananasOnFire:~#
    
    
    • Please try this…

      $sudo apt-get install mysql-server-5.7

      • it gives me:

        root@BananasOnFire:~# sudo apt-get install mysql-server-5.7
        Reading package lists... Done
        Building dependency tree
        Reading state information... Done
        mysql-server-5.7 is already the newest version (5.7.21-0ubuntu0.16.04.1).
        The following packages were automatically installed and are no longer required:
          libdbd-mysql-perl libdbi-perl libmysqlclient20 libterm-readkey-perl mysql-common-5.6
        Use 'sudo apt autoremove' to remove them.
        0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
        2 not fully installed or removed.
        After this operation, 0 B of additional disk space will be used.
        Do you want to continue? [Y/n] y
        Setting up mysql-server-5.7 (5.7.21-0ubuntu0.16.04.1) ...
        /var/lib/dpkg/info/mysql-server-5.7.postinst: line 143: /usr/share/mysql-common/configure-symlinks: No such file or directory
        dpkg: error processing package mysql-server-5.7 (--configure):
         subprocess installed post-installation script returned error exit status 1
        dpkg: dependency problems prevent configuration of mysql-server:
         mysql-server depends on mysql-server-5.7; however:
          Package mysql-server-5.7 is not configured yet.
        
        dpkg: error processing package mysql-server (--configure):
         dependency problems - leaving unconfigured
        No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                                  Errors were encountered while processing:
         mysql-server-5.7
         mysql-server
        E: Sub-process /usr/bin/dpkg returned an error code (1)
        root@BananasOnFire:~#
        
        

Running this command:
sudo apt install mariadb-server
restored everything back to normal. I can log in to mysql PHPMyAdmin, I can work with my WordPress blogs, and everything’s fine - with mysql! I’m confused. I wish someone had warned me that mariadb was going to replace mysql.

Submit an Answer