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

    Joined:
    Sep 29, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    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
    Staff Member

    Joined:
    Feb 25, 2010
    Messages:
    1,842
    Likes Received:
    18
    Trophy Points:
    38
    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
     
Loading...

Share This Page