mysql cannot connect to database if password is specified inline - mysql

I have a problem that I think it is something easy.
I want to connect to mysql database.
If I do the following:
mysql -uroot -premoved mydatabase
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
But if I do:
mysql -uroot -p mydatabase
Enter password: removed
mysql>
It works!!
Why?

You need single quotes around your password.
mysql -uroot '-pabc$def' mydatabase
See mysql password is messing up my dump for reference.

Related

I cant connect mysql

When I try to enter the root user from MySQL Workbench and manually enter it, I get the following error:
your connection attempt failed for user root to the mysql server
Access denied for user 'root'#'localhost' (using password: YES)
I am using mysql -u root code when I want to connect to MySQL via cmd and I get an error in it:
mysql: Unknown operating system character set 'cp857'.
mysql: switch to the default character set of 'utf8mb4'.
ERROR 1045 (28000): Access was denied for the user 'root'#'localhost' (using password: No)
I get a similar error when I try to log in using a password, the only thing that changes is (using password: YES).
What had I better do?
Issue with your password so simply change mysql root password.
here command
mysql -u root
then
mysqladmin -u root password [newpassword]
may help you this.
thanks

I have ubuntu installed with mysql .the below error keeps showing up

linux#ubuntu:~$ mysql
ERROR 1045 (28000): Access denied for user 'linux'#'localhost' (using password: NO)
linux#ubuntu:~$ mysql -u -p
ERROR 1045 (28000): Access denied for user '-p'#'localhost' (using password: NO)
linux#ubuntu:~$
I have ubuntu 14. installed with mysql on a virtual machine vmware .
The above error keeps showing up and I only see the solution everywhere on the internet as :
use "mysql -u -p" but still the error occurs.
It should have space, try this:
mysql -u {username} -p
if you didn't configure mysql(setting password for user), then use just
mysql -uroot, You should mention username.
You can set password for default user root by
mysqladmin -uroot password yourpassword
after setting password run
mysql -uroot -pyourpassword

MySQL Access denied after typing 'mysql -proot'

I am new to MySQL. My issue is, is that after typing mysql -proot in the terminal I am receiving this error:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
I don't know what i am doing wrong. I did create a password. However I don't really know how to put it in, in combo with this command.
I am using CentOS 6 on my server
It's a typo on the syntax. You need a space between proot. It should be
mysql -p root
instead of
mysql -proot
mysql -proot this command is telling mysql to use root as the password, which I'm assuming is not the password. You need to put a space between the -p switch and the username to be get the interactive password prompt.
mysql -p root

Access denied for user 'root'#'localhost' when password print on bash

I am using mysql 5.6
I want to connect mysql from bash.
mysql -u root -pAdmin#1234
i am getting following error-
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
But if i used -
mysql -u root -p
and provide password manually then it works.
Can any one help me out this issue.
I think your password is not exactly "Admin#123". If there are any special characters, use the escape character " \ " in the command line and try it.

Access denied on MySQL database

I have granted all privileges to username:
GRANT ALL PRIVILEGES ON my_db . * TO 'website_user'#'xx.xx.xx.xx' IDENTIFIED BY 'password'
Trying to access database which is in yy.yy.yy.yy from xx.xx.xx.xx:
mysqldump -P 3306 -u website_user -ppassword -h yy.yy.yy.yy my_db > test.sql
But still getting below error:
mysqldump: Got error: 1045: Access denied for user 'website_user'#'xx.xx.xx.xx' (using password: YES) when trying to connect
I also checked firewall. Nothing is preventing to run this query. What am I doing wrong?
Have you also run the following query:
FLUSH PRIVILEGES
That is required to make the new permissions to take effect.