I've read through several posts on here targeted at my exact same issue, but none of the answers I've read have worked for me.
I'm trying to access a database on my network that I created using the following command:
$con=mysqli_connect("1.2.3.4","user","pass","db_name");
All of the data in the query is correct, but I'm getting the error:
Warning: mysqli_connect(): (HY000/1130): Host '4.3.2.1' is not allowed to connect to this MySQL server in C:\xampp\htdocs\ajax_refresh.php on line 4
line 4 is the $con
statement above.
I've gone into the MySQL shell and typed in:
# mysql -u user -p -h 1.2.3.4
and it connects just fine. I've also accessed the database ON this remote computer through an application I wrote in Excel which connects and loads data, so I know my computer has the correct access rights to the server.
I've also added the section here into my httpd-xampp.conf file:
Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
<Directory "C:/xampp/phpMyAdmin">
AllowOverride AuthConfig
Allow from all
Require all granted
</Directory>
to allow access from an external source, and created this user 'user'@'1.2.3.4'
which matches the username and IP address I am connecting from.
What am I doing wrong?