How to uninstall mysql linux

How to uninstall MySQL Server from Ubuntu 22.04.

I am Kinyungu, an IT support specialist and loves to help people to have ease time understanding and using applications.Recently growing a career as a data engineer. In this article, we look on how to uninstall MySQL server in Ubuntu 22.04. What may cause one to uninstall MySQL server? In case you face unexpected issues while using it or the MySQL server updates or even you willingly decide to uninstall it from your computer. So follow along and see how we uninstall our MySQL server. Let us do it. First step, we open our Ubuntu terminal, use the shortcut:
CTRL + ALT + T Good now we are at our terminal, we will write the command to remove MySQL server:

sudo apt-get remove --purge mysql* 

Lets explain this command:
sudo enables you to run with root privileges.
apt-get remove this command only uninstalls a package from your machine but the package configuration file remains in your computer.
—purge mysql* It is passed as parameter to the apt-get remove command. Next let’s us remove the purge:

Lets understand this command, we know what sudo does.
apt-get purge mysql* , this command will delete all files and directories associated with MySQL. At this point we have successfully uninstalled MySQL server from our Ubuntu 22.04.
However its advisable to run the following commands so that our MySQL server is uninstalled completely without leaving residue files.

Running the above commands leaves your system clean and you can continue to use your Ubuntu 22.04 well. This should be considered optional and I would advise one to do this. After uninstalling applications or packages its good to update the system to be up to-date. We will run this command:

This command will update the repositories packages of applications in the system and also updates the kernel to a new version. It has an intelligent manner to handle dependencies of packages. This will involve to handle conflicts that arise due changes in dependencies or removing dependency packages no longer required. If required it installs new packages that will be required by the new kernel version in our system. **Yeah!! **Indeed we did uninstall MySQL server. I hope this article will help anyone uninstalling MySQL server from Ubuntu 22.04 and any other reader looking to learn.

Источник

Как удалить MySQL в Ubuntu

MySQL — это один из самых популярных движков баз данных, которые используются для обеспечения работы веб-сайтов и различных веб-приложений. База данных MariaDB используется на множестве веб-серверов и домашних компьютеров. Если вы хотите сменить базу данных на другую, или, например, установить MariaDB вместо MySQL, то сначала необходимо удалить старую версию.

Читайте также:  Alt linux настройка прокси сервера

В этой статье мы рассмотрим, как удалить MySQL в Ubuntu. Я предполагаю, что программа установлена из официальных репозиториев или PPA, поэтому удалять мы её будем таким же образом.

Удаление MySQL в Ubuntu

В Ubuntu MySQL имеет такое же имя пакетов, сюда относятся mysql-server и mysql-client. Если вы хотите удалить MariaDB, то здесь пакеты будут называться по другому: mariadb-server mariadb-client.

1. Версия MySQL

Давайте сначала посмотрим, какая версия MySQL у вас установлена. Для этого выполните:

Затем вы можете посмотреть установленные пакеты с помощью пакетного менеджера:

sudo apt search mysql-server

2. Удаление MySQL

Остановите сервис базы данных:

sudo systemctl stop mysqld

Чтобы удалить MySQL с сохранением настроек и файлов конфигурации, нужно использовать опцию remove:

sudo apt remove mysql-server mysql-common mysql-server-core-* mysql-client-core-*

Однако, если вы хотите удалить базу данных полностью, вместе со всеми её конфигурационными файлами, нужно использовать purge:

sudo apt purge mysql-server mysql-common mysql-server-core-* mysql-client-core-*

Также нужно зайти в каталог /var/lib/mysql и удалить оттуда файлы базы данных, если они вам больше не нужны:

И удалите папку конфигурационных файлов, если она осталась:

Удалите пользователя и группу, созданные для MySQL:

sudo deluser —remove-home mysql
sudo delgroup mysql

3. Удаление PPA

Если вы устанавливали новую версию базы данных из PPA, и этот репозиторий вам больше не нужен, его тоже желательно удалить. На данный момент официальный репозиторий MySQL устанавливается в стиле CentOS с помощью deb-пакета, который можно скачать на официальном сайте. Вам достаточно его удалить:

sudo apt purge mysql-apt-config

Если ваш репозиторий добавлялся по другому, вы можете найти его и удалить в папке /etc/apt/sources.list.d/. Файлы репозиториев MySQL будут содержать в своём имени слова mysql или mariadb. В моём случае таких файлов нет:

Выводы

В этой небольшой статье мы разобрались, как удалить MySQL Ubuntu с помощью пакетного менеджера. Как видите, просто удалить пакет недостаточно, нужно удалить ещё несколько файлов, если вы хотите полностью очистить свою систему от ненужных файлов.

Обнаружили ошибку в тексте? Сообщите мне об этом. Выделите текст с ошибкой и нажмите Ctrl+Enter.

Похожие записи

Оцените статью

Статья распространяется под лицензией Creative Commons ShareAlike 4.0 при копировании материала ссылка на источник обязательна .

Об авторе

Основатель и администратор сайта losst.ru, увлекаюсь открытым программным обеспечением и операционной системой Linux. В качестве основной ОС сейчас использую Ubuntu. Кроме Linux, интересуюсь всем, что связано с информационными технологиями и современной наукой.

3 комментария к “Как удалить MySQL в Ubuntu”

что делать в такой ситуации: ~$ sudo apt purge mysql-server mysql-common mysql-server-core-* mysql-client-core-*
Reading package lists. Done
Building dependency tree
Reading state information. Done
Note, selecting ‘mysql-server-core-5.0’ for glob ‘mysql-server-core-*’
Note, selecting ‘mysql-server-core-5.1’ for glob ‘mysql-server-core-*’
Note, selecting ‘mysql-server-core-5.5’ for glob ‘mysql-server-core-*’
Note, selecting ‘mysql-server-core-5.6’ for glob ‘mysql-server-core-*’
Note, selecting ‘mysql-server-core-5.7’ for glob ‘mysql-server-core-*’
Note, selecting ‘mysql-server-core-8.0’ for glob ‘mysql-server-core-*’
Package ‘mysql-server-core-5.7’ is not installed, so not removed
Package ‘mysql-server-core-5.5’ is not installed, so not removed
Package ‘mysql-server-core-5.6’ is not installed, so not removed
Package ‘mysql-server-core-5.0’ is not installed, so not removed
Package ‘mysql-server-core-5.1’ is not installed, so not removed
Note, selecting ‘mysql-client-core-5.0’ for glob ‘mysql-client-core-*’
Note, selecting ‘mysql-client-core-5.1’ for glob ‘mysql-client-core-*’
Note, selecting ‘mysql-client-core-5.5’ for glob ‘mysql-client-core-*’
Note, selecting ‘mysql-client-core-5.6’ for glob ‘mysql-client-core-*’
Note, selecting ‘mysql-client-core-5.7’ for glob ‘mysql-client-core-*’
Note, selecting ‘mysql-client-core-8.0’ for glob ‘mysql-client-core-*’
Package ‘mysql-client-core-5.7’ is not installed, so not removed
Package ‘mysql-client-core-5.5’ is not installed, so not removed
Package ‘mysql-client-core-5.6’ is not installed, so not removed
Package ‘mysql-client-core-5.0’ is not installed, so not removed
Package ‘mysql-client-core-5.1’ is not installed, so not removed
Package ‘mysql-client-core-8.0’ is not installed, so not removed
Package ‘mysql-server-core-8.0’ is not installed, so not removed
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation: The following packages have unmet dependencies:
default-mysql-client : Depends: mysql-client-8.0 but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages. Ответить

Читайте также:  Удаленный доступ компьютеру windows linux

что делать в такой ситуации? ~$ sudo apt purge mysql-server mysql-common mysql-server-core-* mysql-client-core-*
Reading package lists. Done
Building dependency tree
Reading state information. Done
Note, selecting ‘mysql-server-core-5.0’ for glob ‘mysql-server-core-*’
Note, selecting ‘mysql-server-core-5.1’ for glob ‘mysql-server-core-*’
Note, selecting ‘mysql-server-core-5.5’ for glob ‘mysql-server-core-*’
Note, selecting ‘mysql-server-core-5.6’ for glob ‘mysql-server-core-*’
Note, selecting ‘mysql-server-core-5.7’ for glob ‘mysql-server-core-*’
Note, selecting ‘mysql-server-core-8.0’ for glob ‘mysql-server-core-*’
Package ‘mysql-server-core-5.7’ is not installed, so not removed
Package ‘mysql-server-core-5.5’ is not installed, so not removed
Package ‘mysql-server-core-5.6’ is not installed, so not removed
Package ‘mysql-server-core-5.0’ is not installed, so not removed
Package ‘mysql-server-core-5.1’ is not installed, so not removed
Note, selecting ‘mysql-client-core-5.0’ for glob ‘mysql-client-core-*’
Note, selecting ‘mysql-client-core-5.1’ for glob ‘mysql-client-core-*’
Note, selecting ‘mysql-client-core-5.5’ for glob ‘mysql-client-core-*’
Note, selecting ‘mysql-client-core-5.6’ for glob ‘mysql-client-core-*’
Note, selecting ‘mysql-client-core-5.7’ for glob ‘mysql-client-core-*’
Note, selecting ‘mysql-client-core-8.0’ for glob ‘mysql-client-core-*’
Package ‘mysql-client-core-5.7’ is not installed, so not removed
Package ‘mysql-client-core-5.5’ is not installed, so not removed
Package ‘mysql-client-core-5.6’ is not installed, so not removed
Package ‘mysql-client-core-5.0’ is not installed, so not removed
Package ‘mysql-client-core-5.1’ is not installed, so not removed
Package ‘mysql-client-core-8.0’ is not installed, so not removed
Package ‘mysql-server-core-8.0’ is not installed, so not removed
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation: The following packages have unmet dependencies:
default-mysql-client : Depends: mysql-client-8.0 but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages. p.s. у вас отсутствует подтверждение получения сообщения или вы его не принимаете? Ответить

Читайте также:  Move rename file linux

Спасибо. Единственное, что мне помогло, когда я забыл root пароль и ничего не помогало его поменять. Респект! Ответить

Источник

How do I uninstall MySQL?

I assume that you don’t need MySQL anymore and you have already taken backup of your important databases. I suggest you to take backup of your important MySQL databases.

Note: Your all mysql data will be lost.

First make sure that MySQL service is stopped.

sudo systemctl stop mysql 

Remove MySQL related all packages completely.

sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-* 

Remove MySQL configuration and data. If you have changed database location in your MySQL configuration, you need to replace /var/lib/mysql according to it.

sudo rm -rf /etc/mysql /var/lib/mysql 

(Optional) Remove unnecessary packages.

(Optional) Remove apt cache.

I guess this doesn’t work. After I do these steps, I tried : sudo apt-get install mysql-client-core-5.5 . But it shows : mysql-client-core-5.5 is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 97 not upgraded. . Is that mean still mysql resides in my pc?

If I try sudo dpkg —purge mysql-server mysql-client mysql-common I get : dpkg: warning: there’s no installed package matching mysql-server dpkg: warning: there’s no installed package matching mysql-client dpkg: warning: there’s no installed package matching mysql-common . I’m bit confused now. Is that mysql have been removed or not?

Why does this remove xbmc and xbmc-bin as well? There are no xbmc tables in mysql when browsing with phpmyadmin .

This also wasn’t sufficient for me — for me, also, the answer here instead worked: stackoverflow.com/a/16178696/368896

all the above solutions are correct but I would try with

sudo apt-get remove --purge mysql* sudo apt-get autoremove sudo apt-get autoclean

This will uninstall all mysql related packages.

This is the easiest/simplest way to get rid of everything mysql-related. Though the wildcard here will match pretty much any package with ‘mysq’ in it’s name, so you might want to specify sudo apt-get remove —purge -s ‘mysql*’ to be more specific.

Seconded on the use of a more specific regex. I ended up using the regex of ‘^mysql-‘ Initially, I was going to run mysql, but found out it caught a ton of stuff unrelated. like:Note, selecting ‘mysql-testsuite’ for regex ‘^mysql*’ Note, selecting ‘mysql-server’ for regex ‘^mysql*’ Note, selecting ‘mysql-server-core’ for regex ‘^mysql*’ Note, selecting ‘mysqmail’ for regex ‘^mysql*’ Note, selecting ‘mysqmail-pure-ftpd-logger’ for regex ‘^mysql*’

I tried all the commands listed here and afterwards if I type ‘mysql’ into the terminal and press tab twice I still see some option come up for mysql, does this mean anything? > mysql mysqld mysql_upgrade mysqlcheck mysql_install_db

Источник

Оцените статью
Adblock
detector