SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    connection problem

    i have installed a database in my local pc
    and an identical database in another pc (say b) in phpmyadmin
    how do i coonect to tat pc(b)
    i used the following to connect from my local pc
    $con1 = mysql_connect('domain_name', 'username', 'passwrd');
    if (!$con1)
    {
    die('Could not connect: ' . mysql_error());
    }

    mysql_select_db("database_name_", $con1);
    but its displaying the following error
    Could not connect: Can't connect to MySQL server on 'www.ristaa.com' (10060)
    wat to do?

  2. #2
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make sure skip-networking is commented out in my.cnf and you have set bind-address=xxx.xxx.xxx.xxx to your server's IP address.

    Also make sure that firewall is not blocking the connection.

  3. #3
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    m using web developer suite in win xp
    where will i find this file
    my.cnf?

  4. #4
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy

    anyone plz help
    i need it urgently

  5. #5
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    On the database server. If it's Linux then it will be in /etc/mysql/my.cnf or similar, depending on distro.

  6. #6
    SitePoint Zealot
    Join Date
    Aug 2007
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:
    mysql_connect('localhost', 'name', 'password') or die(mysql_error());
    mysql_select_db('db_name');

  7. #7
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by decowski View Post
    On the database server. If it's Linux then it will be in /etc/mysql/my.cnf or similar, depending on distro.
    i have already mentioned that m using windows xp
    and web developer suite
    well i found these files
    my-huge.cnf
    my-middle.cnf
    my-large.cnf
    my-small.cnf
    my-innodb-heavy-4G.cng
    now wat to do?

  8. #8
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tariq1654 View Post
    Try this:
    mysql_connect('localhost', 'name', 'password') or die(mysql_error());
    mysql_select_db('db_name');
    its still not working

  9. #9
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by decowski View Post
    Make sure skip-networking is commented out in my.cnf and you have set bind-address=xxx.xxx.xxx.xxx to your server's IP address.

    Also make sure that firewall is not blocking the connection.
    i found the file and did as instructed
    but in vain

  10. #10
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sneha24 View Post
    i found the file and did as instructed
    but in vain
    Did you change it on the machine that is running the database you're trying to connect to? Did you then restart the MySQL server?

  11. #11
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by decowski View Post
    Did you change it on the machine that is running the database you're trying to connect to? Did you then restart the MySQL server?
    yes i did
    but the same error is encountered
    Can't connect to MySQL server on '67.227.152.196' (10060)

  12. #12
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also you should have a database username which is permitted to connect to any host or at least to your IP address/host from where you are trying to host.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  13. #13
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rajug View Post
    Also you should have a database username which is permitted to connect to any host or at least to your IP address/host from where you are trying to host.
    how do i grant this permission?

  14. #14
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The easy way is putting '%' (Any Host) in the Host while creating the database user from phpmyadmin.

    See following link for more details for command line statements.
    http://dev.mysql.com/doc/refman/5.1/...ing-users.html
    http://dev.mysql.com/doc/refman/5.1/en/grant.html
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •