I am trying to export my database running this command :
sudo mysqldump -h wordpress -u root -p bitnami_wordpress >rescue2.database.sql
and got this error :
mysqldump: Got error: 2005: “Unknown MySQL server host ‘wordpress’
(-2)” when trying to connect
I am on a Debian 4.19.208-1 (2021-09-29) x86_64
Thanks for helping it’s been 2 weeks I am searching for…
2
Answers
As suggested by Akina, -h specifies the IP Address of the host,
for example localhost or any local ip on which the mysql server might be running.
Refer below command for further usage.
or:
where the
[OPTIONS]
can be (only some often used):for a complete list you can do:
mysqldump --help
, or take a look at the documentationLook at the file called
wp-config.php
at the top level of your WordPress installation. It contains lines like these:Use that information in your
mysqldump
command like soAvoid running this as root (avoid
sudo
) unless you cannot get it to work any other way.A better way for most WP site operators: use one of the free WordPress backup plugins.