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.

remote connection mysql

Discussion in 'General Discussion' started by rioweb, Nov 29, 2006.

Thread Status:
Not open for further replies.
  1. rioweb

    rioweb Registered

    Joined:
    Jan 28, 2005
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    i do it below:
    ======================================================
    When connecting to a MySQL database on a given server from a different server, replace "localhost" with the IP address of the machine running the MySQL database.

    In the MySQL section in Cpanel, you'd need to add the IP of the machine from which you want to access the database in the "Access hosts" section.

    To give an example:

    Server A with IP address 123.123.123.123 is running a MySQL database
    Server B with IP address 231.231.231.231 wants to access the MySQL database on server A.

    When connecting to the MySQL database on server A from server B, replace "localhost" in the MySQL connect command with 123.123.123.123.

    In Cpanel on server A, add the IP address 231.231.231.231 (server B) to the "Access hosts" section on the MySQL page.

    ========================================================

    This is my script to connect:
    ========================================================
    $conec = mysql_connect('123.123.123.123',"login","passwd") or print (mysql_error());


    if($conec){
    echo "SUCESS";
    }else{
    echo "FAIL";
    }

    mysql_select_db('data_base',$conec) or print(mysql_error());

    =========================================================
    I get conect to mysql with SUCESS, but when I will select the database him mistake comes back.

    Access denied for user 'user'@'231.231.231.231' to database 'painel_novadm'



    Which is the problem?
     
  2. rhysmcmurdo

    rhysmcmurdo Member

    Joined:
    Apr 12, 2006
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
  3. Stefaans

    Stefaans Well-Known Member

    Joined:
    Mar 5, 2002
    Messages:
    451
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Vancouver, Canada
    I notice that robert @ cPanal has submitted a patch. How do I obtain this patch or fix the problem manually?
     
  4. rhysmcmurdo

    rhysmcmurdo Member

    Joined:
    Apr 12, 2006
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    My Quick and nasty patch is as follows...

    Scroll down to line 648 of /usr/local/cpanel/Cpanel/Mysql.pm and below the line:

    $priv =~ s/_priv//;

    Insert the following 2 lines:

    $priv =~ s/_/ /;
    $priv =~ s/tmp_table/temporary tables/;
     
  5. alex318

    alex318 Member

    Joined:
    Jun 4, 2005
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    I tried your quick and nasty fix and it can't work.
     
  6. rhysmcmurdo

    rhysmcmurdo Member

    Joined:
    Apr 12, 2006
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Does it return an error? Did you try removing & re-adding the host once added?
     
  7. zenpig66

    zenpig66 Active Member

    Joined:
    Nov 16, 2002
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    Just so you or anyone else is curious, this did resolve the same issue for me...thanks for the patch. Has this been resolved in any CPanel update?....release, current, edge, etc?
     
  8. iUnknown

    iUnknown Member

    Joined:
    Jul 11, 2008
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    I get this exact problem, and apparantly it is fixed, even in stable releases? How can I fix it?
     
  9. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Please open a support ticket for this issue. This thread is nearly 2 years old.
     
Loading...
Thread Status:
Not open for further replies.

Share This Page