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!

Allow External MySQL connections

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

  1. samarudge

    samarudge Registered

    Joined:
    Sep 29, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    51
    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
    Code:
    Warning: mysql_connect(): Host 'my.hostname.here' 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.
    -Sam
     
  2. cPanelJared

    cPanelJared Technical Analyst

    Joined:
    Feb 25, 2010
    Messages:
    1,835
    Likes Received:
    20
    Trophy Points:
    143
    Location:
    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, 127.0.0.1, or the server's hostname.

    The basic syntax would be like this:

    Code:
    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 http://www.cpanel.net/apps/myip/.

    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 :: 12.4.1.3 GRANT Syntax
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice