0

I just uninstalled and reinstalled mysql in my Ubuntu. After installation, setting root and the password, I tried to login through "mysql -u root -p", but it yields with the following:

The program 'mysql' can be found in the following packages: * mysql-client-core-5.7 * mariadb-client-core-10.0 Try: sudo apt install

I then try "sudo apt install mysql-client-core-5.7" It shows "

mysql-client-core-5.7 is already the newest version (5.7.25-0ubuntu0.16.04.2).

". However it still does not work. Each time I type "mysql", it still yields:

The program 'mysql' can be found in the following packages: * mysql-client-core-5.7 * mariadb-client-core-10.0 Try: sudo apt install

I think that my MySQL server is running good and I have already connected it with my emma client. Anyone has any idea about this issue?

9
  • Have you tried sudo apt install mysql-client-5.7 ?
    – Jos
    Apr 3, 2019 at 8:20
  • @Jos Yes I did. And it shows "mysql-client-core-5.7 is already the newest version (5.7.25-0ubuntu0.16.04.2)". And it keeps show "The program 'mysql' can be found in the following packages: * mysql-client-core-5.7 * mariadb-client-core-10.0 Try: sudo apt install <selected package>" as long as I type "mysql"
    – Prince Luo
    Apr 3, 2019 at 8:29
  • Try this: sudo apt remove mysql-client-core-5.7 and, if that succeeds, sudo apt install mysql-client-5.7.
    – Jos
    Apr 3, 2019 at 8:31
  • worse. Now I try to start mysql and it shows "Failed to start mysql.service: Unit mysql.service is masked." Now my MySQL is shut down.
    – Prince Luo
    Apr 3, 2019 at 8:37
  • Do systemctl unmask mysql.service and then service mysql start.
    – Jos
    Apr 3, 2019 at 8:38

1 Answer 1

2

You have to remove completely mysql. Try this:

    sudo apt-get remove --purge mysql*
    sudo rm -rf /etc/mysql /var/lib/mysql
    sudo apt-get autoremove
    sudo apt-get autoclean

After that you can install again:

    sudo apt-get update
    sudo apt-get install mysql-server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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