Reputation: 531
I try connect my remote server database in php but it's give bellow error
Host 'xx.xxx.xx.xx' is not allowed to connect to this MariaDB server in
My connection code like this
$servername = "my_server_address";
$username = "my_username";
$password = "my_password";
$dbname = "my_db";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
Upvotes: 2
Views: 49118
Reputation: 1
You need to add new user in mariadb, goto privileges and add that can be accessed remotely
Upvotes: 0
Reputation: 320
I had a similar issue after installing "xampp-windows-x64-7.3.6". After looking around and testing several solutions without any changes I did the following:
All works fine for me now.
I did initially add a new user account. That might have caused the problem but I'm not testing this again.
Upvotes: 0
Reputation: 11172
If your credentials are valid, you most likely need to configure MariaDB for remote client access.
See Configuring MariaDB for Remote Client Access
Upvotes: 4