Skip to content

MySQL Host Is Not Allowed to Connect Server

If you encounter the “Host Is Not Allowed to Connect to This MySQL Server” error, it is typically due to MySQL’s default configuration, which restricts connections to the root user from localhost only. This prevents access from other IP addresses, such as a remote vScope server.


Solution: Configure MySQL for Remote Connections

To resolve this issue, you can either create a new administrator user with access from the vScope server or modify the root user’s access (not recommended).

Create a New Administrator User

  1. Open MySQL prompt: Log in to your MySQL server as root.

  2. Run the following commands:

    CREATE USER 'vScopeUserName'@'localhost' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON *.* TO 'vScopeUserName'@'localhost' WITH GRANT OPTION;
    CREATE USER 'vScopeUserName'@'vScopeServerIP' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON *.* TO 'vScopeUserName'@'vScopeServerIP' WITH GRANT OPTION;
    FLUSH PRIVILEGES;
    • Replace vScopeUserName with the username for the new administrator user.
    • Replace password with a strong password.
    • Replace vScopeServerIP with the IP address of your vScope server.

This will create a new administrator user who can connect from both localhost and the specified remote IP address.


If creating a new user is not possible, you can modify the root user’s permissions to allow connections from your vScope server:

  1. Run the following commands in the MySQL prompt:

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'vScopeServerIP' IDENTIFIED BY 'password';
    FLUSH PRIVILEGES;
    • Replace vScopeServerIP with the IP address of your vScope server.
    • Replace password with the root password.

Important

After making these changes, MySQL will accept connections from the specified IP addresses. For enhanced security, use a strong password, avoid modifying the root user, and consider using a firewall to restrict access.

If you continue to experience issues, ensure that:

  • MySQL’s bind-address is set to 0.0.0.0 or a specific IP in your MySQL configuration file (e.g., /etc/mysql/mysql.conf.d/mysqld.cnf).
  • Firewall settings allow inbound connections to MySQL’s default port (3306).

By following these steps, you can allow secure remote access to your MySQL server from your vScope instance.