Error - Failed to connect to MySQL server

Hi,
I have been trying to use the XtraBackup to perform backup on my Percona server (5.5). I’m using Ubuntu 14.04 LTS.
When i run this command - xtrabackup --backup --datadir=/var/lib/mysql/ --target-dir=/
data/backups/mysql/

…i get the following error.
root@mysite:~# xtrabackup --backup --datadir=/var/lib/mysql/ --target-dir=/
data/backups/mysql/
160218 14:57:16 version_check Connecting to MySQL server with DSN ‘dbi:mysql:;m
ysql_read_default_group=xtrabackup;port=3306;mysql_socket=/var/run/mysqld/mysqld
.sock’ as ‘mysql’ (using password: NO).
Failed to connect to MySQL server: DBI connect(’;mysql_read_default_group=xtraba
ckup;port=3306;mysql_socket=/var/run/mysqld/mysqld.sock’,‘mysql’,…) failed: Ac
cess denied for user ‘mysql’@‘localhost’ (using password: NO) at - line 1314.
160218 14:57:16 Connecting to MySQL server host: localhost, user: mysql, passwor
d: not set, port: 3306, socket: /var/run/mysqld/mysqld.sock
Failed to connect to MySQL server: Access denied for user ‘mysql’@‘localhost’ (u
sing password: NO).

Any ideas?
Thanks.

You need to use --user=username --password=password to pass credential

…thanks, works perfect now!

Hi I’m new to mysql and am trying to follow this approach here is the error am getting:

root@Testserver02# innobackupex --user=bkuser --password=wxcvter --no-timestamp /data/backups/new_backup
161011 02:14:38 innobackupex: Starting the backup operation

IMPORTANT: Please check that the backup run completes successfully.
At the end of a successful backup run innobackupex
prints “completed OK!”.

161011 02:14:39 version_check Connecting to MySQL server with DSN ‘dbi:mysql:;mysql_read_default_group=xtrabackup’ as ‘bkuser’ (using password: YES).
161011 02:14:39 version_check Connected to MySQL server
161011 02:14:39 version_check Executing a version check against the server…
161011 02:14:40 version_check Done.
161011 02:14:40 Connecting to MySQL server host: localhost, user: bkuser, password: set, port: 0, socket: (null)
Failed to connect to MySQL server: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ ( 2).

Any help or suggestions would be appreciated.

Thanks