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;
Related
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.
Could not able to connect to the remote mysql server using mysql workbench or direct command line.
When trying it resolves different hostname
When trying directly through command line
mysql --host=10.37.1.92 --port=3306 --user=root --password=password
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'#'myaapvm.local' (using password: YES)
Tried, with password and without password, no luck.
I tried to connect to 10.37.1.92 server but my mysql client try to connect to different server. The only way I can try now is directly login to the machine and do the change in my DB. I have disabled firewall in my mysql DB. Does anyone faced this issue please help.
This server running with maria DB installation.
By default root is not allowed to access the database by using a remote connection. I recommend that you create a new user that will be used for remote connections. You can do that by using the following SQL commands:
CREATE USER 'myuser'#'localhost' IDENTIFIED BY 'mypass';
CREATE USER 'myuser'#'%' IDENTIFIED BY 'mypass';
GRANT ALL ON *.* TO 'myuser'#'localhost';
GRANT ALL ON *.* TO 'myuser'#'%';
FLUSH PRIVILEGES;
You also need to modify your my.cnf if you didn't do that already.
#Replace xxx with your IP Address
bind-address = xxx.xxx.xxx.xxx
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
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?
I am able to connect to mysql through a gui workbench but when i try to connect with my applications datasource (which runs on tomcat) i get:
Access denied for user 'dbuser'#'192.168.100.231' (using password: YES)
i have tried all the options in the mysql reference guide but none worked.
any ideas?
You should grant access to remote machine. Connect to MySql as root and do this:
GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'#'IP' IDENTIFIED BY 'PASSWORD';
FLUSH PRIVILEGES;
Instead of IP you may use host you remote machine.