7

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?

1

5 Answers 5

9

You need to give permissions to connect from remotehost

mysql>GRANT ALL PRIVILEGES ON database.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

Sign up to request clarification or add additional context in comments.

1 Comment

I am getting that error, ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.1.16' (111)
1

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

Comments

0

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.

3 Comments

When creating the user I granted all on domico.* to the user 'domico' what other access do they require?
show me the grants you have set up for 'domico' in the DB. are you positive you are entering in the correct password as well?
The point is, you probably gave ALL privileges on the @localhost (which means you can only access the database from the local computer). You need to specify the proper host (computer) - @'DOMICO-PC', when giving privileges, as I wrote in the answer above.
0

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

1 Comment

Is this neccessary on a two year old question that already has an accepted answer?
0

For all users and all host.

mysql -u root -p

GRANT ALL PRIVILEGES
ON *.*
TO '%'@'%'
IDENTIFIED BY 'password'
WITH GRANT OPTION;

FLUSH PRIVILEGES;

QUIT;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.