Access denied for user ''#'localhost' (using password: NO) in mysql - mysql

I have been used following command but it was not working.
GRANT ALL PRIVILEGES ON *.* TO ROOT#LOCALHOST IDENTIFIED BY "my_password";

You are not connected (in the way of a login & username) to the database, you need to connect. depending on the way you acces the database.
in command line, you can use this:
mysql -pYourpassword -u username

Related

Access denied for user 'user1'#'localhost' goddady

does anybody know in which table godaddy store the users table ?
I have a database created using database wizard and I have added a user using the mysql database wizard to the database. But I still get the error;
Connection failed: Access denied for user 'user1'#'localhost' (using password: YES)
I tried this:
GRANT ALL PRIVILEGES ON *.* TO 'user1'#'%'; FLUSH PRIVILEGES;
But I keep getting;
1045 - Access denied for user 'cpses_odldzcvpqv'#'localhost' (using password: YES)
It must have something to do with the USER_PRIVILEGES table in information_shema. when I type
SELECT * FROM `USER_PRIVILEGES`
IS_GRANTABLE is set to NO.
On unix based systems, mysql treats localhost and tcp/ip separately. If you wish to give access to localhost, you must also give an explicit permission to localhost along with %.
GRANT ALL PRIVILEGES ON *.* TO 'user1'#'localhost' identified by '<password>';
or you can connect via 127.0.0.1 instead of localhost. That'll work.
mysql -u user1 -p<password> --host 127.0.0.1

Can access MySQL via PHPMyAdmin but not through Command Line

Using the same credentials, and the root user having a localhost setting. I can login using the same credentials through a phpmyadmin interface. But not through the command line. I've setup the mysql, changed the password and all else. I should be good to go, however I I keep getting
ERROR 1045 (28000): Access denied for user 'root'#'localhost'
In the command line, this seems to also be the case with other as well. So I am not sure what the issue is.
Try using sudo mysql -u root command to access the mysql-server.
If that does not work create a new user through phpmyadmin :
CREATE USER 'username'#'localhost' IDENTIFIED BY 'password';
Then give it all the privileges :
GRANT ALL PRIVILEGES ON db_name. * TO 'username'#'localhost';
(if you want to give the user access to all the databases, replace db_name with an asterisk (*) )
then flush privileges to reload permissions :
FLUSH PRIVILEGES;
Then try to connect using that user through the command line
sudo mysql -u 'username' -p
You will be asked to type in the password.

MySQL cannot connect [using password: YES]

My new user cannot connect to MySQL database.
Enter password:
ERROR 1045 (28000): Access denied for user 'newusr'#'localhost' (using password: YES)
But I can connect by using:
mysql -u newusr -pPassword
Yes I Flush the Privileges
After some readings i grant some privileges for test
GRANT ALL PRIVILEGES ON . TO 'newusr'#'localhost' WITH GRANT OPTION;
GRANT USAGE ON . TO 'newusr'#'localhost' IDENTIFIED BY 'Password';
no diferents here.
On the server I have 4 users for web purpose (create at the begining) and they connect correct.
All new users have a problem.
Can someone tell me what happen?
There are No anonymouse users, No test default database. I use mysql_secure_installation but no progress on this time.
Since the last time I create a user i twice upgrade MySQL.
I dont see any diferent betwin new and old user by
SHOW GRANTS FOR username
Just for reference, below are the steps to be followed for creating a new account in MySQL:
a. Create user user with password as password where localhost is the MySQL host:
CREATE USER 'user'#'localhost' IDENTIFIED BY 'password';
b. Grant access to the user on db database and table table.
GRANT ALL PRIVILEGES ON 'db' . 'table' TO 'user'#'localhost';
OR, to grant access to all database or table, use *
GRANT ALL PRIVILEGES ON * . * TO 'user'#'localhost';
c. For changes to be effective, you have to reload all the privileges.
FLUSH PRIVILEGES;

Can't get MySQL to recognize host names?

I'm running GRANT ALL PRIVILEGES ON *.* TO 'root'#'myHostname'; and on that hostname and running mysql --host=otherServer --user=root --password and it keeps saying access denied.
ERROR 1045 (28000): Access denied for user 'root'#'myHostname' (using password: YES)
Does MySQL not recognize hostnames?
In MySQL, each account is the combination of a user and the hostname, so the password on this new account is not necessarily the same as that of other root accounts.
Ensure you've created a password on the new account by adding an IDENTIFIED BY clause:
GRANT ALL PRIVILEGES ON *.* TO 'root'#'myHostname'
IDENTIFIED BY 'new_password';
If the account already has a password, the IDENTIFIED BY clause overwrites that password.

can access my sql without using password but cannot access with password

I create a new mysql user by using
CREATE USER 'new-username'#'localhost' IDENTIFIED BY 'new-password';
GRANT ALL ON *.* TO 'new-username'#'localhost' WITH GRANT OPTION;
And I can access mysql by
mysql -u new-username
But I got this error message when I try to access mysql using password
mysql -u new-username -p
error message
ERROR 1045 (28000): Access denied for user 'new-username'#'localhost' (using password: YES)
Something I am missing? Mysql version is Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)
Thanks
Here you required to pass password but you dont have entered any password.
CREATE USER 'new-username'#'localhost' IDENTIFIED BY 'new-password';
GRANT ALL ON *.* TO 'new-username'#'localhost' WITH GRANT OPTION;
mysql -u new-username -p new-password
And if you want to remove password from that then just use following line
SET PASSWORD FOR 'new-username'#'localhost' = ''