Access denied for user 'root'#'localhost' when connecting to mysql - mysql

I have been researching this for close to 4 hours but still, I can't connect my Invision Community 4 forum to my mysql ran on localhost with xampp.
I can connect from the shell, but I can't connect to it from elsewhere.
Access denied for user 'root'#'localhost'

I think that remote root access is disabled by default. Run this SQL command via the shell:
GRANT ALL PRIVILEGES ON *.* TO 'root'#'%' IDENTIFIED BY 'password' WITH GRANT OPTION; FLUSH PRIVILEGES;

Most likely you don't have the other "IPs" (like localhost) defined.
Follow these steps to fix it:
Execute this query: SELECT `Host`, `Password` FROM `mysql`.`user` WHERE USER = 'root';
Check results, in this example the pc host has no password:
Host
Password
localhost
*81F5E21E35407D000A6CD4A731AEBFB6AF209E1B
pc
127.0.0.1
*81F5E21E35407D000A6CD4A731AEBFB6AF209E1B
%
*81F5E21E35407D000A6CD4A731AEBFB6AF209E1B
Check how are you connected: SELECT CURRENT_USER();:
CURRENT_USER()
root#localhost
Now you know how you are connected and if all the user/host pairs share the
same password or not, and maybe update the one that you want to change.

Related

Access denied for user "gestioip'#'localhost' (using password: YES)

I get this error installing gestioip. It connects to the DB as root, it creates a db (gestioip db) then it creates an user (the users: gestioip) but this user can't access the DB. (all this via browser on remote machine)
I've tried like similar posts state the following:
GRANT ALL PRIVILEGES ON dbname.* TO 'gestioip'#'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
With no effect giving the error present on the topic.
If I login the in console with:
mysql -u gestioip -p password
it works.
Needless to say that I've followed all the tutorials/installation manuals of the application.
The access to the DB is following:
gestioip#localhost
gestioip#127.0.0.1
gestioip#localhost.localdomain
Also first line in /etc/hosts:
127.0.0.1 localhost
EDIT:
I installed a ubuntu with GUI and I'm doing the install from the LOCAL browser so no remote problems should arise.
Try one of these to grant access to that user on the db u specified.
GRANT ALL PRIVILEGES ON dbname.* TO gestioip#localhost IDENTIFIED BY 'password'
GRANT ALL PRIVILEGES ON dbname.* TO 'gestioip'#'localhost' IDENTIFIED BY 'password'
U can look at this here
Or check in MySQL references guide.
Instead of localhost use 127.0.0.1
In mysql they are not the same. I imagine your connecting on 127.0.0.1 but permissions are for localhost. That is why the command works. Don't mix and match them

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.

Connect to MySQL Database on Local Network

I actually thought I could do this until I tried. I installed MySQL server on one PC in the Local network IP Address (192.168.1.4) and now I am trying to access it from another PC in the same network (192.168.1.5) but I am unable:
C:\Users\DOMICO>mysql -u domico -h 192.168.1.4 -p
Enter password: **********
ERROR 1045 (28000): Access denied for user 'domico'#'DOMICO-PC' (using password:
YES)
Surprisingly DOMICO-PC is the PC I am trying to connect from. Why is it not connecting to the given host but trying to connect to Local machine?
You need to give permissions to connect from remotehost
mysql>GRANT ALL PRIVILEGES ON database.* TO 'username'#'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
You need to have proper permissions to connect. In the computer that has the DB installed, give your user the proper permissions:
mysql>GRANT ALL PRIVILEGES ON *.* TO 'domico'#'DOMICO-PC';
mysql>FLUSH PRIVILEGES;
You can read more here:
https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql
And here:
https://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html
This is connecting to the intended host as you require it to. t is just stating who is connecting. and where from.
USER#DOMAIN
user : your user running the mysql command
domain : name of the system you are connecting from.
Log into mysql via the server using -u root, ensure the user 'domico' is created and has sufficient access.
creata a new user by mysql server
and give it privileges you can do it by command and by using any server e.g by using workbench
For all users and all host.
mysql -u root -p
GRANT ALL PRIVILEGES
ON *.*
TO '%'#'%'
IDENTIFIED BY 'password'
WITH GRANT OPTION;
FLUSH PRIVILEGES;
QUIT;

MySql: "Accessed denied for user 'root'#'<remote-ip> (using password: YES)" from my Laptop, BUT NOT my coworkers?

I set up a VM (RHEL6) in our company's private cloud, and installed MySQL.
I opened up remote connections like the following so my coworkers and I could connect to it:
GRANT ALL PRIVILEGES ON `dbname`.* TO 'root'#'%';
FLUSH PRIVILEGES;
Here is the result from SHOW GRANTS FOR 'root'#'%';
| GRANT ALL PRIVILEGES ON `dbname`.* TO 'root'#'%' |
1) My coworker can connect to it from the mysql client on his laptop via
mysql -h <hostname> -u root -p dbname
2) I can create a separate VM and connect to the original VM using the same syntax.
However, on my laptop, I can not connect to it. I receive the following error:
ERROR 1045 (28000): Access denied for user 'root'#'<my-ip>' (using passwo
rd: YES)
I've even specifically opened it for my IP using GRANT ALL PRIVILEGES ONdbname.* TO 'root'#'<my-ip>'; FLUSH PRIVILEGES;, which of course shouldn't be necessary, but it didn't work.
I have restarted the MySQL server (which wasn't necessary for my coworkers).
Any idea what could be causing this?