We're using a gcp clouddsql-mysql-8 database to back up application data.
When I try to back up the database using the following parameters:
/bin/mysqldump --defaults-extra-file='/mysqldb/.database.cnf' -h <host-ip> --single-transaction --databases metadata > /mysqldb-backups/dev/deployment/depl-$(date +\%d\%m\%Y).sql
However, when running the command we get the following error:
mysqldump: Got error: 1045: Access denied for user 'admin'#'10.x.x.x' (using password: YES) when trying to connect````
Yet, we're able to log into the database successfully when using the credentials listed in the .database.cnf file
```
# mysql -h 10.x.x.x -u amin -p
```
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
So I am installing snort currently on my ubuntu linux server. I am following this guide here.
At this point, I am at the part in the guide where I am installing Barnyard2 and i need to access my SQL database to save information. linux server is near fresh install with little else on it. When I try to do this part of the guide:
echo "create database snort;" | mysql -u root -p
mysql -u root -p -D snort < ~/snort_src/barnyard2-master/schemas/create_mysql
echo "grant create, insert, select, delete, update on snort.* to \
snort#localhost identified by 'MYSQLSNORTPASSWORD'" | mysql -u root -p
When I run the first line - if I don't enter anything, I get the error message that says:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
If I do enter something, I get a different error:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
I have tried using this in order to reset my password but the command mysql -u root or any form of command similiar results back in the same error, even when it says the password is probably not required for this command. Does anyone know a way in which I can get this to work?
Why don't you break that down into chunks?
First make the database:
$ mysql -u root -p -e 'CREATE DATABASE `snort`'
Import the barnyard schema
$ mysql -u root -p < ~/snort_src/barnyard2-master/schemas/create_mysql
Now create the user & assign permissions for the snort db to the barnyard user
$ mysql -u root -p -e 'GRANT CREATE, INSERT, SELECT, DELETE, UPDATE ON `snort`.* TO snort#localhost IDENTIFIED BY '[SNORT PASSSWORD]'
The commands in your question are running a local mysql client which assumes to connect to a local database by default. If your database is running on a neighbouring Windows box you will need to rethink your parameters.
mysql -u root -p -h 192.168.0.99
When i am running mysqldump with user(lets say test) i am getting error message:
mysqldump: Got error: 1045: Access denied for user 'test'#'localhost' (using password: YES) when trying to connect
Although the database and user details are correct as i am able to login. Also when i use mysqldump without passing -p then it works fine and ask for user password.
mysqldump -u test -p dbtest > dbtest.sql
Enter password:
I tried to pass --port, -h 127.0.0.1 as mentioned in other threads but nothing works.
I am trying to get a local snapshot of a database by running this command:
mysqldump --single-transaction --quick -u user -ppass -h somehost db_name | mysql -u user -ppass -h localhost db_name
Even though this has worked for me in the past, I am now getting this error back:
error: 1045: Access denied for user 'user'#'123.10.123.123' (using password: NO) when trying to connect
I can successfully log in with the username and password above:
mysql -u user -ppass -h localhost
and I have previously granted privileges to the user for the local database, e.g.
grant all on db_name.* to user;
I also find it strange that the error message is returning user#my_ip_address instead of user#localhost when I have specified localhost as the host. I'm also confused as to why it says using password: NO, as I've also provided a password.
It turns out that the remote host that I was attempting to download from had changed. Using the correct new hostname solved the problem.