Problem with access to my database

I have been playing about with this for over an hour and I can not see any mistake.

I am trying to build a database and for some reason I can not get access to the database.

This is my code:

[code:1]$host = "localhost";
$user = "secureit7";
$password = "c28X3kB";
$database = "secdown";

// Set up database connection

$connection = mysql_connect($host,$user,$password)
or die ("Couldn’t connect to server."«»);

$db = mysql_select_db($database, $connection)
or die ("Couldn’t select database."«»);
[/code:1]

Pretty simple !

This is the error:


Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘secureit7’@‘localhost’ (using password: YES) in /home/secdown/public_html/build-tables.php on line 17
Couldn’t connect to server.

Is it the ‘localhost’ that is wrong ?
The database name is set, the username and password I have changed a couple of times but it makes no difference - it still won’t connect.

I must have done something wrong - (its driving me mad !)
how can I check this out ?

Howdy,

It’s likely an invalid username or password problem.

It could be an issue with “localhost”, but that’s not the common cause for the error you’re seeing.

If you log in on the command line, and type:

mysql -u secureit7 -p

Are you able to get it to authenticate with this or any other password?

You can try passing in "-h HOSTNAME" to try a hostname other than localhost.
-Eric

I have just tried it with the
administration password, and it worked !

But the password, that I set for it is here:

And this does not work.

Should I re-start the mySQL server ?
Will that help ?

Our messages crossed in cyber space !

I typed in your suggestion and got:

> mysql -u secureit7 -p
Enter password: ERROR 1045 (28000): Access denied for user ‘secureit7’@‘localhost’ (using password: NO)

In theory, restarting should not help.

In the last tab there is "Remote hosts".

What hosts are defined in there?
-Eric

There is only "localhost" shown under Allowed hosts.

Does the reply to your suggested cmd mean that it thinks
that my password is wrong?

> mysql -u secureit7 -p
Enter password: ERROR 1045 (28000): Access denied for user ‘secureit7’@‘localhost’ (using password: NO)

Yeah, if localhost is in there, and you’re sure the username is correct, then the password is somehow incorrect.

If you’re 100% certain about the username, and you’ve attempted to change the password from that interface and it still doesn’t work, it may be a bug.

At that point, I’d recommend filing a bug report using the Bugs and Issues link below.
-Eric