problem connecting to database :: Warning: mysql_connect() [
Posted: Tue Jan 13, 2009 10:51 pm
Hello all
I have a problem connecting my msql db to the server. the db i use and have created works completely fine in my localhost however when i upload the files with the include to connection.php the realtime live sie comes up with
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in /includes/connection.php on line 4
Database connection failed: Access denied for user 'root'@'localhost' (using password: YES)
Here is what i have tried so far.
gone into mysql console and ran this line
Also i tried the UPDATE and FLUSH PRIVALIGES cmd's to no joy
my constants.php file is correct to the mysql cmd like so
my connection.php looks like this
I have spoke to my server administrator and they say its completely fine using a mysql db from another server as such so how or where am i going wrong because i am banging my head against the wall.
p.s the testing server url prefix is set to my local localhost
I have a problem connecting my msql db to the server. the db i use and have created works completely fine in my localhost however when i upload the files with the include to connection.php the realtime live sie comes up with
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in /includes/connection.php on line 4
Database connection failed: Access denied for user 'root'@'localhost' (using password: YES)
Here is what i have tried so far.
gone into mysql console and ran this line
Code: Select all
SET PASSWORD FOR
'root'@'localhost' = OLD_PASSWORD('new_pass');my constants.php file is correct to the mysql cmd like so
Code: Select all
<?php
define("DB_SERVER","localhost");
define("DB_USER", "root");
define("DB_PASS", "pxxxxxxx");
define("DB_NAME", "my-db");
?>Code: Select all
<?php
require("constants.php");
//1. create a connection
$connection = mysql_connect(DB_SERVER,DB_USER,DB_PASS);
if (!$connection) {
die("Database connection failed: " . mysql_error());
}
// 2. Select a database to use
$db_select = mysql_select_db(DB_NAME,$connection);
if (!$db_select) {
die("Database selection failed: " . mysql_error());
}
?>p.s the testing server url prefix is set to my local localhost