简体   繁体   中英

mysql configuration unstartable: recovery procedure

A VPS was created to handle multiple wordpress sites using mariaDB as the supporting database. In the process of installing matomo for site statistics, somehow the entire mysql area (I don't know how to call it given the confusion between mariadb and mysql use of names) got warped, apparently beyond use.

mysql -h 127.0.0.1 -P 3306 -u root -p firstdb
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (61)

variant

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

sudo /etc/init.d/mysql stop

runs, while the command invoking mysqld does not find the command.

sudo mysqld_safe --skip-grant-tables & 

fails with sudo: mysqld_safe: command not found .

at which point it is suggested in some places to install mysql-server but that does not fly because mysql --version returns Ver 14.14 Distrib 5.7.24 and thus the server version has to be inline. Out of curiosity, Ubuntu does pick up on this and stops:

Preparing to unpack .../mysql-server-5.7_5.7.24-0ubuntu0.16.04.1_amd64.deb ...

Aborting downgrade from (at least) 10.0 to 5.7.

Somehow, I conclude that mysql got installed in addition to mariaDB and messed up configurations royally, possibly changing the user configurations making the databases inacessible.

Two avenues are now available:

  1. Remove installed mysql installations and recast mariaDB as per these indications . But I wonder about the sanity of this method
  2. Spin up a new VPS, using the backups of the wordpress directories and the mysql directory with the various databases.

Which is prefereable? And assuming going forward with the second alternative, while the wordpress archive should be straightforward, what pitfalls could I encounter in handling the existing databases and then integrating anew matomo?

If you have now MySQL 5.7, that's a MySQL, not a Mariadb one. Maybe you've rollback the version for something. If you're sure you have Mariadb installed before, then do the installation of mariadb 10.

For doing installation of mariadb, you only need to install it with apt:

apt-get install mariadb-server

If you have a problem with the uninstallation or upgrade, or you have the old package stuck on install, uninstall it:

apt-get remove mysql-server

Normally, you don't have problem with remove. It does not remove configuration or databases (unless you do an dpkg --purge). But if you need to do a backup for more security about the process, you can backup /etc/mysql and /var/lib/mysql folders.

At any case, you can reset configuration to default ones (search for a clean my.cnf file for mysql 5.7). If you configure on it the basic things (storage folder and no more) you have recovered the installation with your own databases.

If you're unsure, or you think is for another thing, then check the mysql logs, and post the error itself for continue searching for new options.

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