SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jun 2001
    Location
    Bogotá, Colombia
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problems with mysql_connect in my Linux

    We are making a Database-driven website using php and MySQL, this is for our degree project for the university. We are using the “Building a Database-Driven Web Site Using PHP and MySQL” from sitepoint.com as a guide and it has been very helpful.

    In our development machine (in home) we have Windows 98 and Personal Web Server, in this environment everything is going right, but, in university’s machine we have Linux (redhat) and Apache, in that machine the PHP and MySql were already installed and We can’t reinstall it. The server name is Server1 or yyy.com.co

    We are working the pages from a virtual host named server74 or xxx.com.co.

    The problem is that using Linux we can’t connect to MYSQL server from the explorer using PHP. In that case the system returns the following errors:

    If we use the connect sentence with ‘localhost’:

    $dbcnx = mysql_connect('localhost', 'root', 'rgehtyu');

    Returns the error: “Warning: MySQL connection failed. Can’t connect to localhost MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (111) in www.xxx.com.co/xxx.php on line 47.

    If we use the connect sentence with ‘server1’:

    $dbcnx = mysql_connect('server1', 'root', 'rgehtyu');

    Returns the error: “Warning: MySQL connection failed. Host ‘server1.yyy.com.co’ is not allowed to connect to this MySQL server in www.xxx.com.co/xxx.php on line 47.

    We think the problem is that MySQL server was installed with another server name and does not have registered server1 as a allowed server or something like that. But We didn’t find the file to define this.

    We hope anyone of you could help us, thank you.

  2. #2
    SitePoint Member
    Join Date
    Jun 2001
    Location
    UK
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have to edit the access tableson the machine with mysql.

    Something along the lines of:

    GRANT ALL PRIVILEGES ON *.* TO root@www.xxx.com.co
    IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

    It might be more efficient using the IP rather than www.xxx.com.co but im not sure

    -dibby


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
  •