Koozali.org: home of the SME Server

Please HELP!!!!! Unable to connect to MySQL Server via PHP

discovery

Please HELP!!!!! Unable to connect to MySQL Server via PHP
« on: December 13, 2006, 02:30:34 AM »
Hi All!!!

I am having the following problem....

I was ready to migrate my SME 6.0.1-01 server to SME 7.

The upgrade process went belly UP!!! Dammit!!!

I have done a fresh install of SME 6.0.1-01 and installed MySQL 4.1.22

I have also installed phpmyadmin - All is working ok here I have restored my databases and all is appearing to be ok here I can also see the database tables ok.

Webmail is working ok as well!!!

Now my problem is that I am unable to connect to the MySQL server via a PHP script.

I am using the following php script

<?php

   define("DB_HOST", "192.168.69.254");
   define("DB_USERNAME", "root");
   define("DB_PASSWORD", "password");
   define("DB_NAME", "testdb");


   $link = mysql_connect(DB_HOST,DB_USERNAME,DB_PASSWORD);

   if (!$link) {
      die('Could not connect to MySQL: ' . mysql_error());
   }

   echo 'Connection OK';
   mysql_close($link);

?>

the error message i am getting is .....

Could not connect to MySQL: Host 'adroit-sme-server.adroitcomputing.com.au' is not allowed to connect to this MySQL server.

I have also created another user in phpmyadmin called test1 this user has full access to the databases, and I am getting the same error message as above.

Where in the world have I gone wrong?? I would appreciate any help!!!!

Cheers

Rob aka Discovery

Offline xboxer21

  • **
  • 60
  • +0/-0
My guess is edit bindaddress in my.cnf
« Reply #1 on: December 15, 2006, 04:19:08 PM »
I'm no way a mysql user/developer but when i was trying to install mythtv i learnt a few things about mysql. Here's my guess..... Take a look at /etc/my.cnf and make a note of bind-address= [IP Address]
Use that IP address in your define("DB_HOST", "192.168.69.254") if the php scripts are hosted on that particular SME box.
You can also edit the bind-address to 0.0.0.0 in the my.cnf template to allow connections to your mysql database.

Thanks
......