Some months ago I created a Wordpress implementation using NGINX and mariadb (on a Raspberry Pi running Raspbian Stretch).

This developed some problems (as a result of a failed attempt to install phpmyadmin). I managed to delete most of these although phpmyadmin was still a user, and I could use Wordpress.

I wanted to do a fresh start (keeping the wordpress database) which I backed up using.

sudo mysqldump -u root -p wordpress > wordpress.sql

I backed up the existing using

sudo systemctl stop mariadb
sudo mv /var/lib/mysql /var/lib/.mysql

I ran the following to reset mariadb, setting root password

sudo dpkg-reconfigure mariadb-server-10.1
sudo mysql_secure_installation

I created a new empty wordpress database and restored from database backup

sudo mysql -Bse "create database wordpress"
pv wordpress.sql | sudo mysql wordpress

I restarted with sudo systemctl start mariadb

Unfortunately when I try to connect I get an error "Error establishing a database connection"

Can anyone suggest what I may have done wrong?

  • Can you connect to the database from the command line? – roaima Jan 28 at 8:14
  • You miss the user, who access wordpress database. – Romeo Ninov Jan 28 at 8:21
  • 1
    @RomeoNinov thanks - this put me on the right path to solve my problem. – Milliways Jan 29 at 2:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.