norixtagの日記

思いつきで出来ています。

Ubuntu Server 16.04 でMySQLからMariaDBに鞍替えした時にUnable to set password for the MariaDB “root” userでインスコ出来なかった件

Ubuntu Server 16.04インスコ時にLAMPも入れたんだが、
MariaDBに変えようと思い、MariaDBインスコ時にハマったのでメモ。

Unable to set password for the MariaDB "root" user

An error occurred while setting the password for the MariaDB administrative user.
This may have happened because the account already has a password, or because of a
communication problem with the MariaDB server.

You should check the account's password after the package installation.

Please read the /usr/share/doc/mariadb-server-10.1/README.Debian file for more
information.

 

なんて言われてムムム……。

ていうか↓が全て。これの通りにやれば万事解決

askubuntu.com

sudo apt-get purge mysql*

MySQL関連パッケージを根こそぎ削除
その後、

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

で関連ファイルも削除。
そんでもっかい

sudo apt update
sudo apt install mariadb-server

MariaDBインスコ
このページにたどり着いた人は公式リポジトリは追加されてると思うので割愛。

 

イラスト図解式 この一冊で全部わかるサーバーの基本

イラスト図解式 この一冊で全部わかるサーバーの基本