Backup database Unknow server host

Hi everybody,

I`ve been trying to make a backup database with command:
as admin manual.

mysqldump --single-transaction -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_date +"%Y%m%d".bak

Server = localhost
username = dbuser
password = dbpassword
db_name = dbname

But appear an error:

mysqldump: Got error: 2005: "Unknow MySQL server host (localhost) (-2) when trying to connect.

Somebody can help me to explain why does not working? or how can I solve the problem?

Thank you.

Please post your occ config:list here to see if you are using socket or TCP connections.

You could also use my script which can automate the backup process:

Invoked with the following command it will create a backup of your Nextcloud directory, data directory and database:
.\ncupgrade /path/to/nextcloud -ob

Ubuntu 16.14
virtual machine
apache2 & MariaDB php7 www-data:
Nextcloud version: 13.01
Do you think maybe can be happen because is an a virtual machine?

Please read the start post more actively.

No, but are you using socket or tcp connections?