mysql db user host - mysql

Access denied for user 'root'#'xxxxxxxxxxxxx' (using password: YES)
even though I have an entry in mysql.user table that has host as % and user as root.
I did grant all privileges on . to 'root'#'%';

I would need to see how you are trying to connect to the server to give you additional information. It is possible that the call to the client (or whatever you are using) is munged in some way.

Related

ERROR 1045 (28000): Access denied for user 'admin'#'localhost' (using password: YES)

I'm trying to log in to mysql via a bash script or to be more specific, I want to check if the passed parameters for the mysql user are thes of an admin user.
For this reason it has to be possible to log in to mysql via a one line command e.g.
mysql -u $dbadmin -p$dbadminpass
To test why I didn't work, I tried it myself on the command line an I'm getting this Error:
ERROR 1045 (28000): Access denied for user 'admin'#'localhost' (using password: YES)
I created the use on #localost and gave all privileges. All my reasarch had no reasults so far.
I checked for any typos
You can try this:
GRANT ALL PRIVILEGES ON *.* TO 'admin'#'%';
FLUSH PRIVILEGES;
or try to connect to 127.0.0.1 not to localhost
This is not a problem with MySQL installation or set-up.
Each account name consists of both a user and host name like 'user_name'#'host_name', even when the host name is not specified. From the MySQL Reference Manual: https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_usage
MySQL account names consist of a user name and a host name. This enables creation of accounts for users with the same name who can connect from different hosts.
This also allows MySQL to grant different levels of permissions depending on which host they use to connect.
When updating grants for an account where MySQL doesn't recognize the host portion, it will return an error code 1133 unless if it has a password to identify this account.
Also, MySQL will allow an account name to be specified only by it's user name, but in this case it is treated as 'user_name'#'%'.

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

Mariadb host works on “localhost” but not IP alternative - 127.0.0.1

I am trying to connect to my database through an ash tunnel using sequel pro but it is not working and forces me to use 127.0.0.1 when entering "localhost" which leads to the problem where if I run on the command line:
mysql --host "localhost"
It works
If I run:
mysql --host "127.0.0.1"
I get the access denied error:
ERROR 1698 (28000): Access denied for user 'root'#'localhost'
What is going on?
I have tried:
update user set host='%' where host='localhost'
but this does not work.
Many SQL servers have two or more different user entries for every user that might come in via either localhost or remote. (127.0.0.1 counts as remote).
For example, for the root user, you might have these three user entries.
CREATE USER 'root'#'localhost' IDENTIFIED BY REDACTED;
CREATE USER 'root'#'127.0.0.1' IDENTIFIED BY REDACTED;
CREATE USER 'root'#'%.example.com' IDENTIFIED BY REDACTED;
There's nothing much special about the name root except that it has been granted a lot of privileges when your MySQL was installed. You need to grant the same privileges to the other versions of root#whatever you create.
I created a new user:
CREATE USER 'non-root'#'localhost' IDENTIFIED BY '123';
and then granted them all the same privileges:
GRANT ALL PRIVILEGES ON * . * TO 'non-root'#'localhost';
and then deleted root and renamed non-root to root
and now it finally works.

MySQL Grant user on specified domain

I tried to grant user for database at database.com from a domain but it failed. Only the domain's IP works. (example.com is having IP 1.1.1.1)
For example:
GRANT super ON *.* TO 'user'#'1.1.1.1' IDENTIFIED BY 'password';
The above works fine. I can access the database remotely.
GRANT super ON *.* TO 'user'#'example.com' IDENTIFIED BY 'password';
This failed!
When I try to use PHP script to connect from example.com to database.com, it says:
mysql_connect('database.com', 'user', 'password');
Warning: mysql_connect() [function.mysql-connect]: Access denied for
user 'user'#'1.1.1.1' (using password: YES)
Any idea why giving privilege to user base on domain 'user'#'example.com' doesn't work?
As per my understanding your server administrator has restricted to host name, you can check in your server config file (my.cnf) if "skip-name-resolve" is updated.
Even you should call based on IP in your application instead of name but if still you want to do it then comment "skip-name-resolve" in your config file.

Unable to connect mysql using ip address

I try to connect my db using host address as my ip address 203.199.209.**,but not able to connect db.if i try to connect my db using host address as localhost it connected successfully.
How to solve this issue?
MySQL grants access based on which host you are connecting from.
Run this command as root:
SELECT user, host FROM mysql.user;
These are the users which exist on your server. Notice the host column.
In short, a user is defined as both a user name (user) and a point of connection (host). When you access your server as localhost, you actually login as some_user#localhost. On the other hand, when you access the sever via its IP address, you actually login as some_user#your.ip.address.here. I guess the latter does not exist on your server.
You may want to create a new user such as some_user#your.ip.address.here or some_user#% (the percent sign is a wildcard; here, it means "any host"):
CREATE USER 'some_user'#'your.ip.address.here' IDENTIFIED BY 'your_password';
GRANT ALL ON your_database.* to 'some_user'#'your.ip.address.here';
If you wish to dig further, see this manual page for more details about MySQL access control, and this page for the CREATE USER syntax.
[edit]
Obviously, as suggested by others, you first need to make sure your server listens to this IP address (203.199.209.**). But if this were not already the case, you should get the following error:
ERROR 2003 (HY000): Can't connect to MySQL server on '203.199.209.**' (111)
The error you are getting definitely indicates a permission issue.
For mysql-5.7.15-winx64 (Windows Version), login as "root" user and run the following queries in MYSQL:
CREATE USER 'user'#'localhost' IDENTIFIED BY 'pass';
GRANT ALL PRIVILEGES ON *.* TO 'user'#'localhost' WITH GRANT OPTION;
CREATE USER 'user'#'%' IDENTIFIED BY 'pass';
GRANT ALL PRIVILEGES ON *.* TO 'user'#'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
and then Re-start your MYSQL DB.
For this version of MYSQL DB no changes are required in "my-default.ini" located in the same location as "bin" folder.