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
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.
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.
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.
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.
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".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With