I was use my host name as local server when i run my php code on my laptop but now i register my website on web so what host name now i use for my sql connection i give my site ip address to as a host in sql but the site gives me an error "Host '31.170.163.50' is not allowed to connect to this MySQL
It looks like you're trying to connect to your database from a different server. Is your PHP script still running on your own PC?
The message you get is because you try to reach the database from the computer at address 31.170.163.50, which is not allowed. Quite often, when you have 'normal' simple, shared hosting, you are not allowed to use the database from other computers directly. Only the scripts on the server itself are allowed to use the database.
So, the solution would be: Put everything, scripts and database, on your web hosting platform, and use localhost
or 127.0.0.1
when your PHP script needs to connect to your database.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments