Using mysqldump on windows(2003-server - MariaDB) produces following error:
mysqldump: Got error: 1045: "Access denied for user 'ODBC'#'localhost' (using password: YES)" when trying to connect
Commands I used:
mysqldump --user=root --password=password -h127.0.0.1 --port=3306 database > backup.sql
mysqldump -uroot -ppassword database > backup.sql
mysqldump -uroot -p(enter password on promt) database > backup.sql
mysqldump -u root -p password database > backup.sql
mysqldump -u root -ppassword database > backup.sql
Etc, anything I used, same error popped up.
Looks like some default-hardcoded user/password is used.
I can connect to mysql -uroot -p just fine.
Internets have seen this error before, but I have not seen proper solution to this or I am oblivios to something.
Any insight would be amazing.
Thanks.
Double check your - char in your commands. Sometimes copy&paste produces a different hyphen char.
Your command below should work:
mysqldump -u root -ppassword database > backup.sql
Related
I am trying to copy my database with a different name. I've found this:
$ mysqldump yourFirstDatabase -u user -ppassword > yourDatabase.sql
$ mysql yourSecondDatabase -u user -ppassword < yourDatabase.sql
But I do not understand clearly.
So I have 2 databases: lab1, lab2. lab2 contains 0 tables since I want this to be a copy of lab1.
So 'lab1' is 'yourFirstDatabase' and lab2 is 'yourSecondDatabase', right? then what is 'yourDatabase?'
Also I got the error below:
$ mysqldump -uroot lab1 -u user -ppassword > yourDatabase.sql;
mysqldump: [Warning] Using a password on the command line interface
can be insecure. mysqldump: Got error: 1045: Access denied for user
'user'#'localhost' (using password: YES) when trying to connect
process work just like you said.For yourDatabese you are creating a temporary backup file that is used only for transferring yourFirstDatabase
In my EC2 Linux, I would like to create a cron job to auto backup a MySql DB in AWS RDS. I had tried to run
/usr/bin/mysqldump -u dbusername -p'dbpassword' dbname > /path/backup.sql
but I got an error
"Warning: Using a password on the command line interface can be insecure.
mysqldump: Got error: 1045: Access denied for user 'dbusername'#'localhost' (using password: YES) when trying to connect".
What is wrong and how do I change the 'dbusername'#'localhost' to 'dbusername'#'xxx.xxxxxxxx.xx-xxxxxx-x.rds.amazonaws.com'?
I had also tried to write a MySql script to download backup.sh but unable to as it cannot go beyond
mysql -u 'dbusername' --password="dbpassword" -h 'xxx.xxxxxxxx.xx-xxxxxx-x.rds.amazonaws.com'
it is able to login but it shows the MySQL prompt
>
anything beyond that e.g.
> use db;
it will show
Warning: Using a password on the command line interface can be insecure.
mysqldump -u dbusername -p'dbpassword' -h hostname.here.com dbname > /path/backup.sql
The same -h works for all mysql* commands, e.g. if you want to connect to RDB:
mysqldump -u user -p'pass' -h db.us-east-1.rds.amazonaws.com dbname
I am logged into an AWS instance and trying to copy a mysql database to a .sql file. I am using the command:
mysqldump -u [username] -p [databasename] > [database].sql
Then entering the password and the following message comes up.
"mysqldump: Got error: 1045: Access denied for user '[username]'#'localhost' (using password: YES) when trying to connect."
I can login directly to mysql using the same credentials as above, but still get the same error.
I have tried a bunch of different ways for the command above, but it seems to be an issue with permissions or something similar. The user does have all privileges for the database when looking in phpmyadmin so I am not sure what is wrong? Any suggestions? Thanks
This works for me:
mysqldump -uroot -pxxxx dbname > dump.sql
or you can specify the host:
mysqldump -h localhost.localdomain -uroot -pxxxx dbname > dump.sql
Check to make sure you don't have different instances of mysql running
Thank you all for your input! It got me thinking about what else it could possibly be. I then tried using the -h parameter as well, which wouldn't work with "localhost". It finally worked when I used the Private IP Address for the AWS instance.
mysqldump -h [PrivateIPAdress] -u [UserName] -p [DatabaseName] > [Database].sql
mysqldump -u [username] -p
ENTER YOUR PASSWORD
USE [databasename]
SOURCE /path/to/[database].sql
I am not sure, but worth a try because you said you are able to login into that machine.
mysqldump -u root -p Databasename > backup.sql
How to set in this command password? I need run this command in Python script.
At this time, asking me for a password.
mysqldump -u root -pPassword Databasename > backup.sql
Read this for some basic security info.
Assuming you're on Unix...
env MYSQL_PWD=<password> mysqldump -u root -p Databasename > backup.sql
According to the mysql docs.
It's driving me mad!
I can connect to my server's MySQL via Terminal using:
mysql -u admin -p and then password fine.
Trying the same with:
mysqldump --user admin --password=mypassword test123 > /backups/test.sql
just gets me mysqldump: Got error: 1045: Access denied for user
Any words of wisdom for me, do I need to grant more priviledges to admin?
Thanks,
Chris
Your mysqldump commandline is wrong. use
--user=admin
or
-u admin
As i see, you do the wrong command, because is: mysqldump --user=admin --password=mypassword test123 > /backups/test.sql i suggest to add --opt and -h serverip just to be sure.