I'm just starting to code and I try to host a Wordpress website on a server of my school. However, as soon as I upload the website on the Wordpress interface with the plugin "all-in-one migration", the database crashed. Wordpress gives me the error :

Warning: mysqli_real_connect(): (HY000/2002): Connection refused in /var/www/html/wordpress/wp-includes/wp-db.php on line 1626

When I check my database, I find it :

● mariadb.service - MariaDB 10.3.22 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: deactivating (final-sigterm) (Result: timeout) since Thu 2020-06-18 21:23:34 UTC; 28min ago
     Docs: man:mysqld(8)
  Process: 10644 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
  Process: 10645 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 10647 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1
 Main PID: 10695 (mysqld)
   Status: "Waiting for page cleaner"
    Tasks: 3 (limit: 563)
   Memory: 65.1M
   CGroup: /system.slice/mariadb.service
           └─10695 /usr/sbin/mysqld

Jun 18 21:23:40 genius systemd[1]: Starting MariaDB 10.3.22 database server...
Jun 18 21:23:41 genius mysqld[10695]: 2020-06-18 21:23:41 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 10695 ...
Jun 18 21:39:50 genius systemd[1]: mariadb.service: State 'stop-sigterm' timed out. Skipping SIGKILL.

And, of course, when I try to enter my database, I get the code :

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

I tried to restart the database, but it doesn't return any response.

By searching on StackOverflow, a few answers suggest changing localhost to a local IP like in the file "wp-config.php", but it didn't change anything.

Can you help me please ?

  • You cannot connect to a service that is shutting down. New connections are the first thing that gets removed. Why it shuts down after 16 minutes of uptime is the question that needs answering. Is there more logfile journalctl -n 50 mariadb.service? Or an external /var/log/mysql/mysql.log?
    – danblack
    Jun 19, 2020 at 1:06

1 Answer 1


first check wp-config.php for this 4 lines

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

then Check Your Database Host Information and if you failed do this action add define('WP_ALLOW_REPAIR', true); in your wp-config.php and after you have done ,navigate with http://yourwebsite.com/wp-admin/maint/repair.php. and better before doing disactivate all pluging via ftp rename plugins to plugins.deactivate. repair wordpress and finnaly Update WordPress Site URL in wp_options tables Update WordPress Site URL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.