How can I get Mariadb running again? My WordPress site is returning:
Error establishing a database connection
It seems that my database is down. (I updated Ubuntu 19.04 to 19.10 and have had multiple problems.)
I went ahead and checked for MySQL installed packages, forgetting that I was actually using Mariadb.
So I installed MySQL; discovered I should not have done that; removed MySQL; and followed these instructions to install Mariadb 10.4.
sudo apt install mariadb-server
is returning:
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:
mariadb-server : Depends: mariadb-server-10.4 (>= 1:10.4.8+maria~disco) but it is not going to be installed
So I removed Mariadb by doing (source)
apt-get remove --purge mysql*
apt-get remove --purge mysql
apt-get remove --purge mariadb
apt-get remove --purge mariadb*
apt-get --purge remove mariadb-server
apt-get --purge remove python-software-properties
And tried to reinstalling it, again, using the same guide mentioned above:
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
this last command apt-key ...
returns
Executing: /tmp/apt-key-gpghome.XsKKHEPfCn/gpg.1.sh --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
gpg: key F1656F24C74CD1D8: 6 signatures not checked due to missing keys
gpg: key F1656F24C74CD1D8: "MariaDB Signing Key " not changed
gpg: Total number processed: 1
gpg: unchanged: 1
sudo apt update
sudo apt install mariadb-server
# MariaDB 10.4 repository list - created 2019-11-03 16:26 UTC
# http://downloads.mariadb.org/mariadb/repositories/
deb [arch=amd64] http://mariadb.mirror.pcextreme.nl/repo/10.4/ubuntu disco main
deb-src http://mariadb.mirror.pcextreme.nl/repo/10.4/ubuntu disco main
sudo systemctl start mariadb
returns
Failed to start mariadb.service: Unit mariadb.service not found.
dpkg -l | grep -e mysql -e mariadb
returns
rc automysqlbackup 2.6+debian.4-1 all daily, weekly and monthly backup for your MySQL database ii dbconfig-mysql 2.0.11ubuntu2 all dbconfig-common MySQL/MariaDB support ii default-mysql-client 1.0.5ubuntu2 all MySQL database client binaries (metapackage) ii libdbd-mysql-perl:amd64 4.050-2build1 amd64 Perl5 database interface to the MariaDB/MySQL database rc libmysqlclient18:amd64 5.6.30-0ubuntu0.15.10.1 amd64 MySQL database client library ii libmysqlclient21:amd64 8.0.17-0ubuntu2 amd64 MySQL database client library ii mysql-client 8.0.17-0ubuntu2 all MySQL database client (metapackage depending on the latest version) ii mysql-client-8.0 8.0.17-0ubuntu2 amd64 MySQL database client binaries ii mysql-client-core-8.0 8.0.17-0ubuntu2 amd64 MySQL database core client binaries ii mysql-common 1:10.4.8+maria~disco all MariaDB database common files (e.g. /etc/mysql/my.cnf) ii mysql-server-8.0 8.0.17-0ubuntu2 amd64 MySQL database server binaries and system database setup ii mysql-server-core-8.0 8.0.17-0ubuntu2 amd64 MySQL database server binaries rc mysql-utilities 1.6.4-1 all collection of scripts for managing MySQL servers rc php7.0-mysql 7.0.24-1+ubuntu17.04.1+deb.sury.org+1 amd64 MySQL module for PHP ii php7.1-mysql 7.1.16-1+ubuntu17.10.1+deb.sury.org+1 amd64 MySQL module for PHP ii postfix-mysql 3.4.5-1ubuntu1 amd64 MySQL map support for Postfix ii roundcube-mysql 1.3.8+dfsg.1-2 all metapackage providing MySQL dependencies for RoundCube
Update 1
It looks like I have two sets of databases. I found one in /var/lib/mysql-10.2
and another in /var/lib/mysql
. /var/lib/mysql-upgrade
is empty.
Update 2
I followed these steps and stopped where it states
But it may not help, as your system is seriously broken, ...
here are some outputs:
sudo apt-get update
:
Hit:1 http://archive.canonical.com/ubuntu eoan InRelease Get:2 http://security.ubuntu.com/ubuntu eoan-security InRelease [92.9 kB] Hit:3 http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu eoan InRelease Hit:4 http://archive.ubuntu.com/ubuntu eoan InRelease Get:5 http://archive.ubuntu.com/ubuntu eoan-updates InRelease [88.4 kB] Fetched 181 kB in 1s (135 kB/s) Reading package lists... Done
sudo apt-get install -f
:
Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
sudo apt-get dist-upgrade
:
Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
apt-cache policy python3
:
python3: Installed: 3.7.5-1 Candidate: 3.7.5-1 Version table: *** 3.7.5-1 500 500 http://archive.ubuntu.com/ubuntu eoan/main amd64 Packages 100 /var/lib/dpkg/status
sudo apt install mariadb-server
:
Reading package lists... Done Building dependency tree Reading state information... Done 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: mariadb-server : Depends: mariadb-server-10.3 (>= 1:10.3.17-1) but it is not going to be installed E: Unable to correct problems, you have held broken packages.
Update 3
I noticed /var/run
has no mysql folder ... I am assuming mysqldb is not running. So I tried this:
sudo /etc/init.d/mysql start
[....] Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details. failed!
sudo systemctl status mysql.service
● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset: enabled) Active: failed (Result: exit-code) since Sun 2019-11-03 18:07:45 PST; 44s ago Process: 6033 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE) Nov 03 18:07:45 courtens.org systemd[1]: mysql.service: Service RestartSec=100ms expired, scheduling restart. Nov 03 18:07:45 courtens.org systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5. Nov 03 18:07:45 courtens.org systemd[1]: Stopped MySQL Community Server. Nov 03 18:07:45 courtens.org systemd[1]: mysql.service: Start request repeated too quickly. Nov 03 18:07:45 courtens.org systemd[1]: mysql.service: Failed with result 'exit-code'. Nov 03 18:07:45 courtens.org systemd[1]: Failed to start MySQL Community Server.
Update 4
I found this and followed the steps, and it finally worked. Or it looked like it would, but I never got the server back.
From the page:
Building MariaDB on Ubuntu
$ sudo apt-get install software-properties-common \
devscripts \
equivs
Installing Build Dependencies
$ sudo apt-key adv --recv-keys \
--keyserver hkp://keyserver.ubuntu.com:80 \
0xF1656F24C74CD1D8
$ sudo add-apt-repository --update --yes --enable-source \
'deb [arch=amd64] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu '$(lsb_release -sc)' main'
$ sudo apt-get build-dep mariadb-10.3
Building MariaDB
...
/var/lib
; IIRC some versions of the MySQL-related packages deleted the database when they were purged./var/lib/mysql/
. I also have a dismountedLVM
mirror backup to fall back on.eoan
, but the server system wasbionic
.