Hi,
We have an inhouse MySQL database that is only accessible inhouse - you cannot access it remotely. There is no user/password required to access this database - you simply go to the IP address in your browser and everything is there.
We would like to move it online so we can access it remotely from anywhere.
I set up a cPanel account and imported this database so it's accessible via a domain name. When I go to the domain name in my browser, here is exactly what shows on my browser screen:
Could not connect to DB server:Access denied for user ''@'localhost' (using password: NO)
Access denied for user ''@'localhost' (using password: NO)
Here are the first few lines of the config.php file:
<?php
ini_set('display_errors', 'On');
error_reporting (E_ERROR | E_PARSE);
$config["db"] = "cpanelusername_databasename";
$config["user"] = "cpanelusername_databaseusername";
$config["password"] = "databasepassword";
$config["host"] = "localhost";
$config['baseurl'] = "https://ourdomain.com";
$crypt = "companyname";
Here is the code of the connect.php file:
<?php
$db = mysql_connect($config["host"], $config["user"], $config["password"]);
$sqlnames = "SET NAMES utf8;";
mysql_query($sqlnames);
if(!$db) echo "<p>Could not connect to DB server:" . mysql_error() . "</p>\n";
mysql_select_db($config["db"], $db) or die (mysql_error());
$config['site_db']=$db;
?>
Is there anything here that is incorrect? I can't find any other files that would connect the database to the webserver.
Thank you in advance for your assistance.
We have an inhouse MySQL database that is only accessible inhouse - you cannot access it remotely. There is no user/password required to access this database - you simply go to the IP address in your browser and everything is there.
We would like to move it online so we can access it remotely from anywhere.
I set up a cPanel account and imported this database so it's accessible via a domain name. When I go to the domain name in my browser, here is exactly what shows on my browser screen:
Could not connect to DB server:Access denied for user ''@'localhost' (using password: NO)
Access denied for user ''@'localhost' (using password: NO)
Here are the first few lines of the config.php file:
<?php
ini_set('display_errors', 'On');
error_reporting (E_ERROR | E_PARSE);
$config["db"] = "cpanelusername_databasename";
$config["user"] = "cpanelusername_databaseusername";
$config["password"] = "databasepassword";
$config["host"] = "localhost";
$config['baseurl'] = "https://ourdomain.com";
$crypt = "companyname";
Here is the code of the connect.php file:
<?php
$db = mysql_connect($config["host"], $config["user"], $config["password"]);
$sqlnames = "SET NAMES utf8;";
mysql_query($sqlnames);
if(!$db) echo "<p>Could not connect to DB server:" . mysql_error() . "</p>\n";
mysql_select_db($config["db"], $db) or die (mysql_error());
$config['site_db']=$db;
?>
Is there anything here that is incorrect? I can't find any other files that would connect the database to the webserver.
Thank you in advance for your assistance.
Last edited by a moderator: