Ubuntu Server 22.04.4 complete removal of MySQL #37

Completely removing MySQL on Ubuntu Server
Stop the mysql server: sudo service mysql stop
Remove mysql components and its dependencies:
sudo apt-get purge mysql-server mysql-client mysql-common
same line: mysql-server-core-* mysql-client-core-*
We delete the directories where MySQL was stored
sudo rm -rf /etc/mysql
sudo rm -rf /var/lib/mysql
To check the deletion, let's make a mysql --version request
Automate the removal of mysql (if required)
In the user directory, with appropriate access rights
let's create a file:
#!/bin/bash
sudo service mysql stop
sudo apt-get purge mysql-server mysql-common mysql-client mysql-server-core-* mysql-client-core-*
sudo rm -rf /etc/mysql
sudo rm -rf /var/lib/mysq
save it as delete-mysql
After that, assign a user and make the file executable
Conditionally:
sudo chown super-root /home/super-root/delete-mysql
sudo chmod +x /home/super-root/delete-mysql
You will need to run the file on behalf of someone who has access to the directory and permissions to run it
Attention! The script must be launched with the command:
sudo echo 'y' | /home/super-root/delete-mysql
This is needed to automatically answer "yes" to apt's uninstall question.
If after uninstallation errors appear during a new installation
Most likely there is an old configuration somewhere
To correct this, enter these commands:
sudo apt-get purge mysql* -V
sudo rm -rv /var/lib/mysql
sudo rm -rv /var/log/mysql*
sudo rm -rv /etc/mysql*
sources of inspiration:
uninstall mysql
phpandmysql.ru/mysql/how-to-u...
if something is wrong after uninstalling and installing
qna.habr.com/q/461943
creating files in bash
habr.com/ru/companies/ruvds/a...
The following composition was used in the dubbing:
Beside Me - Patrick Patrikios

Пікірлер