I'm using exactly the same credentials to connect to a remote mysql server.
host % is given to the user.
I can connect via my php application on localhost to remote mysql server
however whenever i do command line on localhost
mysql -u username -p'password' -h remoteserver.domain.com
it throws an error
ERROR 1045 (28000): Access denied for user 'username'#'10.50.2.4' (using
password: YES)
what am i missing here?
Your mysql command line is wrong. Mysql has the funky syntax of:
mysql -u username -ppassword -h remoteserver.domain.com
instead of
mysql -u username -p password -h remoteserver.domain.com
Note the p tag and password placement.
turns out that i should do away single quotes in my password for windows-based mysql command
instead of
mysql -u username -p'password' -h remoteserver.domain.com
this actually works
mysql -u username -ppassword -h remoteserver.domain.com
reason why i use single quotes because my password contains non-alpha characters which works in linux but not on windows based command line
Related
I am trying to connect mysql hosted onto a remote machine and everytime I provide the remote host with -h option it's still taking local machines hostname
example
mysql -u user-p pass -h "IP" -P 3306 -D DB
Enter password:
ERROR 1045 (28000): Access denied for user 'user'#'localhost' (using password: YES)
Not sure why it's ignoring the remote host name. It's showing localhost's hostname instead of the IP I am providing
You can't put a space between -p and the password.
mysql -u user -ppass -h IP -P 3306 -D DB
If there's nothing immediately after -p, it prompts for the password instead of getting it from the command line.
This error is causing the rest of the command line to be parsed incorrectly. It thinks -p is the last option, because the next word doesn't begin with -.
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 trying to access mysql from the command line with:
mysql -u root --password password
but I get
Enter password: ERROR 1045 (28000): Access denied for user
'root'#'localhost' (using password: NO)
Why is it saying that I'm not using a password?
I use the following syntax:
mysql -h [host] -u [user] -p[password]
Notice that there's no space between the -pand the [password]
The correct syntax for what you're typing is:
mysql -h [host] -u [user] --password=[password]
(Check reference manual... it's section 4.5.1 for version 5.5)
If you're working on the same computer where MySQL is installed, you can skip the -h [host] piece, or type -h localhost.
I first tried to add C:\Program Files\MySQL\MySQL Server 8.0\bin into the path (env variable), didn't work out.
It might be another reason but in my case it was all about copying and pasting the password, typing it out manually solved the issue.
I have mysql 5.1 set up and running.
I need to connect to:
location: comm.eng.bxg.com
name: amntxy
user: username
pswd: password
I have tried using
mysql -h amntxy -u username -p
Also tried: use amntxy and use comm.eng.bxg.com/amntxy
But I am unable to connect.
I get the following error:
ERROR 2005 (HY000): Unknown MySQL server host
I also tried mysql_connect but keep getting the error : mysql_connect is not recognized as internal or external command
But I do not understand hwo I can connect here.
Please help.
Thank you
mysql -h comm.eng.bxg.com -u username -p
After this it will ask for a password.
Optionally you can also directly specify the database name that you want:
mysql -h comm.eng.bxg.com -u username -p db_name
But again, this is 100% optional. You will be able to select or change it after with the command USE db_name.
when I am trying to connect mySql data base from cmd it giving some error like -
c:\xampp\mysql\bin>mysqladmin -u root password 123123
mysqladmin: connect to server at localhost failed
error:Access denied for user root#localhost (using password : NO)
Shouldn't that be:
mysqladmin -u root -p PASSWORD
?
The syntax looks wrong to me, just like Roberto said. You could also use this
mysqladmin -u root -h localhost -p
It should then ask you for the password. This way you can be sure that only a wrongly entered PW prevents you from connecting.
It should be:
mysqladmin -u root -p
and it will prompt you for a password. If you need to enter the password directly via the command line ( say you need to write a script), you should be able to do that with:
mysqladmin -u root -p123123