Yashvantsinh Zala
Yashvantsinh Zala

Reputation: 531

not allowed to connect to this MariaDB server in php

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

Answers (3)

Genius Homwe
Genius Homwe

Reputation: 1

You need to add new user in mariadb, goto privileges and add that can be accessed remotely

Upvotes: 0

Oliver E.
Oliver E.

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:

  • Uninstall xampp
  • Restart machine
  • Reinstall xampp
  • Restart machine
  • Importing old databases via phpmyadmin

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

Daniel
Daniel

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

Related Questions