简体   繁体   中英

How can I reset MySQL Community Server to default setting in Ubuntu 22.04?

the result of the command journalctl -xeu mysql.service Please help I am running Ubuntu 22.04 I had MySQL running perfectly before I installed MariaDB for a project and after I uninstalled MariaDB and installed MySQL but the server won't start.

The first Error I got when I type mysql in the terminal

"ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)" in 5 steps How can I fix this MySQL error on Ubuntu 22.04? 

I tried to fix this by deleting the mariaDB files I found in the mysqld directory and editing the file mysqld.sock with the following informations

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

[mysqld]
socket=/var/run/mysqld/mysqld.sock
[client]
socket=/var/run/mysqld/mysqld.sock

How do I completely uninstall and restore the MySQL server.

I tried to fix this by deleting the mariaDB files I found in the mysqld directory and editing the file mysqld.sock with the following informations

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

[mysqld]
socket=/var/run/mysqld/mysqld.sock
[client]
socket=/var/run/mysqld/mysqld.sock

This didn't work and I tried to uninstall and install mysql with the following command.

sudo apt remove --purge mysql-server mysql-client
sudo apt autoremove
sudo apt autoclean
sudo apt install mysql-server

now I got the message during installation.

MySQL has been frozen to prevent damage to your system. Please see /etc/mysql/FROZEN for help.

Then I ran this set of commands:

  1. service mysql start
  2. systemctl unmask mysql.service
  3. service mysql start
  4. journalctl -xeu mysql.service
  5. sudo less /var/log/mysql/error.log

I tried to check the error log but there is no error log file How do I completely uninstall and restore the MySQL server.

I have been able to solve the problem using these two lines of command

sudo apt remove --purge mysql-\*
sudo apt install mysql-server mysql-client

After this, I continued with the MySQL setup and it was a good as new

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM