Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqldump access denied

Tags:

mysqldump

When I try to backup using mysqldump from ssh, I run the following command on machine 10.64.1.1. It gives the following error.

mysqldump --user=test -p=password --host=10.64.1.2 --tab=. databasename tablename

mysqldump: Got error: 1045: Access denied for user 'test'@'10.64.1.1' (using password: YES) when trying to connect

However, I can access mysql using the same user and password.

mysql --user=test -p[password]

Current user: [email protected]

SSL: Not in use

Current pager: stdout

Using outfile: ''

Using delimiter: ;

Server version: 5.0.91-50-log Percona SQL Server, Revision 73 (GPL)

Protocol version: 10

Connection: 10.64.1.2 via TCP/IP

Updates:

If I do following mysql document: --password[=password] or -p[password].

Since my password contains special symbol @, Mysql cannot detect user correctly. It complains:

mysqldump: Got error: 1044: Access denied for user 'test'@'%' to database

like image 620
chnet Avatar asked Apr 23 '11 21:04

chnet


People also ask

What permissions are needed for Mysqldump?

mysqldump requires at least the SELECT privilege for dumped tables, SHOW VIEW for dumped views, TRIGGER for dumped triggers, and LOCK TABLES if the --single-transaction option is not used. Certain options might require other privileges as noted in the option descriptions.

Why Mysqldump is not working?

If mysqldump is not identified by the cmd prompt that means it cannot recognize where the mysqldump.exe is located. You need to add path of the directory where the exe is located in the PATH variable under environment variables. After doing that your command will start working in the cmd prompt.

Does Mysqldump work with MariaDB?

The mysqldump command line utility is commonly used to make backups and transfer data from one MariaDB or MySQL server to another. It's included with MySQL and MariaDB client software.


2 Answers

You have to run CMD.EXE as the Administrator:

Right click on cmd.exe --> Run as Administrator and then type your command:

mysqldump -u[username] -p[password] -h[ip or name] yourdatabasename > c:\sqlfile.sql

It should work fine.

like image 118
HENG Vongkol Avatar answered Sep 19 '22 12:09

HENG Vongkol


I think that you would have to lose the = when using -p or do it with --password :

--password[=password], -p[password]

The password to use when connecting to the server. If you use the short option form (-p), you cannot have a space between the option and the password. If you omit the password value following the --password or -p option on the command line, you are prompted for one. Specifying a password on the command line should be considered insecure. See Section 6.6, "Keeping Your Password Secure".

like image 33
Spyros Avatar answered Sep 18 '22 12:09

Spyros