0

i tried to replace mysql with MariaDB, removed, installed, removed, installed again mysql and i am stuck now when i try to reinstall mysql

sudo apt-get install mysql-server

with this message:

There is a MySQL server running, but we failed in our attempts to stop it. Stop it yourself and try again!

But there isnt any mysql server running:

ps -ef | grep mysql

xxxxx 13881 13041 0 00:59 pts/6 00:00:00 grep --color=auto mysql

Any idea how i can solve this problem and install mysql again?

0

Please take a look at this link. According to this answer

The solution could be removing the following symbolic link:

root@box{~}:la /etc/systemd/system/mysql.service lrwxrwxrwx 1 root root 35 Feb 9 22:55 /etc/systemd/system/mysql.service -> /lib/systemd/system/mariadb.service

If you get the following error: 1524: Plugin 'unix_socket' is not loaded while connecting to the MySQL server

Try the answer from this link

Become root

sudo su

Stop MySQL, bypass authentication, connect as root

/etc/init.d/mysql stop
mysqld_safe --skip-grant-tables &
mysql -uroot

Use the administrative db

use mysql;

Reset the root password

update user set password=PASSWORD("mynewpassword") where User='root';

Reset authentication method

update user set plugin="mysql_native_password";

Exit the mysql console

quit;

Stop and start mysql related processes

/etc/init.d/mysql stop
kill -9 $(pgrep mysql)
/etc/init.d/mysql start

Exit su mode and try connecting to the mysql server

  • Okay, after removing that link i get now this: mysql_upgrade: Got error: 1524: Plugin 'unix_socket' is not loaded while connecting to the MySQL server – piper Aug 20 '17 at 13:35
  • Okay, i removed that link and typed the other commands. mysqld_safe --skip-grant-tables gives me this message: mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists. mysql -uroot comes up with this error message: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) – piper Aug 20 '17 at 20:25
  • try running the following commands: sudo /etc/init.d/mysql restart and then sudo /etc/init.d/mysql start. If that doesn't work then try connecting using this command: mysql -h 127.0.0.1 -P 3306 -u root -p <password for root user> – cwithmichael Aug 20 '17 at 20:52
  • Thanks for your answer, but it is still the same. I could start mysql and i see it is up and running with ps -ef | grep mysql mysql 18067 1 0 00:21 ? 00:00:00 /usr/sbin/mysqld root 18242 12670 0 00:24 pts/7 00:00:00 grep --color=auto mysql But when i try to remove/purge/install it or try to connect with mysql -h 127.0.0.1 -P 3306... i still get ERROR 1524 (HY000): Plugin 'unix_socket' is not loaded – piper Aug 20 '17 at 22:25
  • sorry it didn't work... for my last attempt try this link – cwithmichael Aug 21 '17 at 1:17
0

Got it now...

sudo apt-get remove --purge mysql*
sudo apt-get remove --purge mariadb*

and remove all mysql databases (you will be asked if you want to remove them), then I can do a fresh install of mysql-server without error messages.

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.