DK0066 - [error] Error - DK0066: IMPORT_DB_DUMP: Error (1): YERROR 1130 (HY000): Host 'XXXXX' is not allowed to connect to this MariaDB server

Dear all,

this one drove me nuts for a bit so writing this here for everyone, but especially for me :slight_smile:

I was getting the DK0066 error like many experienced.

1- First issue was a normal site creation in DevKinsta. I fixed this by following this thread: Something bad happened: in create new site - #17 by StormChild

2- I then faced a similar issue when importing a site from Kinsta. I was getting an error and when looking into the main.log file I saw the error

[error] Error - DK0066: IMPORT_DB_DUMP: Error (1): YERROR 1130 (HY000): Host ‘172.172.0.5’ is not allowed to connect to this MariaDB server

I solved this one as follows:

The error “Host ‘172.172.0.5’ is not allowed to connect to this MariaDB server” indicates a MySQL/MariaDB privilege issue where the specified host (likely the web server or FPM container in DevKinsta’s Docker network) does not have the necessary permissions to connect to the database server

To fix this, you need to grant the correct privileges to the database user. The best approach involves accessing the database container via the command line and updating the user permissions.

Solution Steps

  1. Access the Database Container:
    Open your terminal or command prompt and run the following command to get a bash shell inside your DevKinsta database container:

    bash

    docker exec -it devkinsta_db bash

    If your container name is different, adjust devkinsta_db accordingly.

  2. Log in to MariaDB:
    Once inside the container, log in to the MariaDB server using the root user. When prompted for a password, use the database password found in the DevKinsta UI for that site.

    bash

    mysql -u root -p

  3. Grant Remote Access Privileges:
    Inside the MySQL shell, you need to grant privileges to your user, allowing connections from any host (represented by %). Replace 'your_database_password' with the actual password from DevKinsta.

    sql

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your_database_password' WITH GRANT OPTION;
    FLUSH PRIVILEGES;
    
    

    This command allows the root user to connect from any host (%) to all databases and tables (*.*).Alternatively, for better security, you could specify the exact IP address 172.172.0.5 instead of %:

    sql

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.172.0.5' IDENTIFIED BY 'your_database_password' WITH GRANT OPTION;
    FLUSH PRIVILEGES;
    
    
  4. Exit MySQL and Restart the Container:
    Type exit; to leave the MySQL shell, and then type exit again to leave the Docker container’s bash session.Restart your devkinsta_db container using your Docker desktop application or the command line for the changes to take effect.

  5. Retry the Import:
    Go back to DevKinsta and try the database import again. The error should now be resolved.

Howdy @itibook :waving_hand: ,

I see this is your first time posting, so welcome to the community.

You brought the :fire: on your first post!

Thank you kindly not only for your generosity, but also for those immaculate instructions (with beautiful formatting).

Personally, I have not encountered this issue, but if/when I’ve ever do, I’ve bookmarked this thread and will follow our instructions.

Again, thank you for sharing and contributing to the community.

kindly,

Shawn C.