Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Allow External MySQL connections

Discussion in 'Database Discussions' started by samarudge, Sep 29, 2010.

  1. samarudge

    samarudge Registered

    Sep 29, 2010
    Likes Received:
    Trophy Points:
    I'm trying to connect to a database on a server running CPanel from my desktop. When I try to connect I get the error
    Warning: mysql_connect(): Host '' is not allowed to connect to this MySQL server
    How do I allow hosts to connect to the server? I have access to CPanel and WHM but not root SSH.
  2. cPanelJared

    cPanelJared Technical Analyst

    Feb 25, 2010
    Likes Received:
    Trophy Points:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    grant to user@host

    You will need to grant access to the user at your desktop system's IP address. Currently, access will be granted only to the user at either localhost,, or the server's hostname.

    The basic syntax would be like this:

    GRANT ALL ON mydb.* TO 'someuser'@'somehost';
    Where mydb would be your database name, someuser would be the user that already has access to the database, and somehost is your desktop's IP address. You can verify the public IP address that the server will "see" from your desktop by browsing

    You can enter this either at the MySQL CLI command prompt or in phpMyAdmin.

    I recommend the following section of the MySQL manual, which explains the GRANT command in detail:

    MySQL :: MySQL 5.1 Reference Manual :: GRANT Syntax

Share This Page