I'm trying to do database management via SSH for Bitnami's WordPress Multi-tier Stack/ Specifically I want to export and do an initial import (though I will probably just create a new database).

When I run the following commands, I get the following errors:

Command: mysqldump -u root -p bitnami_wordpress > bitnami_wordpress.sql

Output: mysqldump: Got error: 2002: "Can't connect to local MySQL server through socket '/opt/bitnami/mariadb/tmp/mysql.sock' (2)" when trying to connect

This also creates an 0B SQL file in my home directory.

Command: mysqladmin -u root -p status (I enter my password)


mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket . 
'/opt/bitnami/mariadb/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: 
'/opt/bitnami/mariadb/tmp/mysql.sock' exists!

Command: cd /opt/bitnami/mariadb/ + ls


bin                 CREDITS            include         licenses   README-wsrep
COPYING             data               INSTALL-BINARY  plugin     sbin
COPYING.thirdparty  EXCEPTIONS-CLIENT  lib             README.md  share

Command: sudo find . -name mysql




find /opt/bitnami/mysql/ -name "*.cnf" 

Output: Nothing

find /opt/bitnami/mariadb/ -name "my.cnf"



Command: nano /opt/bitnami/mariadb/share/my-medium.cnf (what's the difference between my-medium, my-small, and my-large)?


# The following options will be passed to all MariaDB clients
#password       = your_password
port            = 3306
socket          = /opt/bitnami/mariadb/tmp/mysql.sock

NOTE: /opt/bitnami/mariadb/tmp/mysql.sock does not exist.

Command: mysql.server start (Though if my WP site is working wouldn't this already be running?)

Output: -bash: mysql.server: command not found

I've poked around a bit and came across MariaDB's Documentation about 2002 errors, but I don't seem to have the same .conf file (nor do I know where to look)

...from here I have no idea where to go, I've only done limited database management via shell.

Concise questions:

  1. How do I export my database without getting the 2002 error?
  2. How do I overwrite / update my database?

Any help would be much appreciated and thanks in advance!

  • You need to start the MariaDB server. – Michael Hampton Sep 13 '18 at 0:48
  • Hi Michael, Thanks for the comment. If my stack is already running a WordPress site, I guess I'm curious as to why I'd need to start the MariaDB server...wouldn't it already be running? Also, when I run mysql.server start I get -bash: mysql.server: command not found ...do I need to edit the mysql.server script? – Ryan Dorn Sep 13 '18 at 8:04

The folks at Bitnami came through. I was connecting to the wrong host.

Find the host: sudo cat /opt/bitnami/wordpress/wp-config.php | grep 'DB_HOST'

To export:

mysqldump -h provisioner-peer -u root -p bitnami_wordpress > bitnami_wordpress.sql

Your Answer

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

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