Two domains using same mqsql database

April 25, 2015 385 views
MySQL PHP Ubuntu

I have two domains using the same droplet and same mysql database. The data is fetched and displayed fine for the first domain, but, the second domain doesn't show any data.

Connecting to database and selecting the database is happening, but, the page (for the second domain) doesn't display any data. What could possibly be the problem? Please help. Thanks.


$link = mysql_connect('localhost', 'username', 'passowrd') or die(mysql_error());
if ($link) 
echo ('Connect susscufully ..... and ...... '); 
echo ('Not connect');

mysql_select_db('enarexperts',$link) or die(mysql_error());
echo "Connected to Database";
1 comment
  • Are you using the same MySQL user and connection information for both sites/domains?

1 Answer

Yes, same MySQL user and same code for both domains. I even tried to create a new mysql use and grant access, same result. I can connect to mysql database via putty fine.

Have another answer? Share your knowledge.