Host is not allowed to connect to this MariaDB server XAMPP

XAMPP is a popular open-source software package that allows developers to set up a local web server environment for testing and developing web applications. One of the components included in XAMPP is MariaDB, a widely used open-source relational database management system.

However, when working with MariaDB in XAMPP, you may encounter the error message, "Host is not allowed to connect to this MariaDB server." In this article, we will explore the causes of this error and provide solutions to resolve it.

Error:

mysqli_real_connect_error

Possible Causes of the "Host is not allowed to connect to this MariaDB server" Error:

  1. Access Privileges:

    • This error often occurs due to insufficient access privileges for the user trying to connect to the MariaDB server. Ensure that the user has the necessary privileges to access the database.
  2. Host Restrictions:

    • MariaDB server, by default, may restrict connections to specific hosts. If your host is not in the list of allowed hosts, you'll encounter this error.
  3. Firewall or Port Blocking:

    • A firewall or port blocking issue can prevent the connection between your application and the MariaDB server. Make sure the firewall is not blocking the MariaDB port (usually 3306).
  4. Incorrect Configuration:

    • Check your application's configuration files to ensure that the host, username, password, and port settings match the MariaDB server configuration in XAMPP.
  5. MariaDB Service Status:

    • Ensure that the MariaDB service is running in XAMPP. Sometimes, the server might be stopped or not properly started.

 

It's due to crash of User table in MySQL database. The solution is simple. Just follow below step.

  1. Open XAMPP control panel
  2. Click MySQL > Config > my.ini

xampp_control_panel_3_3

Add below line under [mysqld] tag

skip-grant-tables

Check the below image.
mysql_config_file

Save my.ini

Restart MySQL server by pressing STOP and START button.

 

Conclusion:

Encountering the "Host is not allowed to connect to this MariaDB server" error in XAMPP can be frustrating, but it is usually caused by issues related to access privileges, host restrictions, firewall settings, or configuration mismatches.

By following the solutions outlined in this article, you can troubleshoot and resolve this error, ensuring smooth communication between your applications and the MariaDB server within your XAMPP environment

 


You might also like:

techsolutionstuff

Techsolutionstuff | The Complete Guide

I'm a software engineer and the founder of techsolutionstuff.com. Hailing from India, I craft articles, tutorials, tricks, and tips to aid developers. Explore Laravel, PHP, MySQL, jQuery, Bootstrap, Node.js, Vue.js, and AngularJS in our tech stack.

RECOMMENDED POSTS

FEATURE POSTS