I have written some code and am currently running it using loachost however am trying to set it up so that I can run the app from other computers, I am using MySql and after searching online I found that if I replace "localhost" with my IP address (found from google) for the host name on MySql I will be able to connect from other machines, I tried this and got an error saying that I cannot connect to the server and listed some checks:
Check that MySql is running on the servr - how do I check this?
Check that MySql is running on port 3306 - I changed this to 3307 when making the database however, I tried both and got the same errors.
Check if root has rights to the IP address from your address - I am running this from the same computer and it has worked fine with localhost so I dont know why it wouldnt but how would I check this?
Make sure you are providing password - I did when I tried to connect to the database and got this error.
Could someone please help me, I have been searching for hours and cant find how to fix this.
You need to grant access to the account root@%
.
root@localhost
and root@%
are two different accounts. When you're using localhost
as the hostname, and specify user name root
, you use root@localhost
.
When connecting using an external IP, you need to grant database access for root@%
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.