467,903 Members | 1,809 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,903 developers. It's quick & easy.

Cannot connect to the database

Hello,

My domain: www.coaster.ch
My database: coasters
User: bettina

In the programm I wrote:

<?php
$db_server = "www.coaster.ch";
$db_name = "coasters";
$db_user = "bettina";
$db_passwort = "";
$dbh = mysql_connect ("localhost", "coaster_bettina", "") or die ('I
cannot connect to the database because: ' . mysql_error());
mysql_select_db ("coaster_coasters");
?>

I get the following message:

Warning: mysql_connect(): Access denied for user
'coaster_bettina'@'localhost' (using password: YES) in
/home/coaster/public_html/connection.php on line 11
I cannot connect to the database because: Access denied for user
'coaster_bettina'@'localhost' (using password: YES)

I also tried with:

$db_name = "coaster_coasters";
$db_user = "coasters_bettina";

What do I do wrong?
Here can I define a password for my database in phpMyAdmin?

Any help will be welcomed.

Bettina

Jul 17 '05 #1
  • viewed: 5002
Share:
4 Replies
be*****@coaster.ch:
Here can I define a password for my database in phpMyAdmin?


Log in to phpmyadmin and click on "Privileges". There you can add a new
User and set the privileges.

After you added/changed a user make sure, that you click "Reload MySQL"
in PHPMyAdmin (first page after logon).

adlerweb
Jul 17 '05 #2
be*****@coaster.ch wrote:
: Hello,

: My domain: www.coaster.ch
: My database: coasters
: User: bettina

: In the programm I wrote:

: <?php
: $db_server = "www.coaster.ch";
: $db_name = "coasters";
: $db_user = "bettina";
: $db_passwot = ""; [[[ my typo messed something up here ]]]
You set a bunch of variables but you never use them, what are they for?
: $dbh = mysql_connect ("localhost", "coaster_bettina", "") or die ('I
^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^
-1- -2- -3-

-1-

Is the database on the localhost of the web server? Why did you need to
know the server name of mysql if it's just on the web server? (It
commonly is, but I have to ask.)

-2-

Where did you get that name from ("coaster_bettina")? In your intro you
said you were user "bettina".

-3-

Mysql accounts commonly have passwords. Does your account have a
password you need to use?

: cannot connect to the database because: ' . mysql_error());
: mysql_select_db ("coaster_coasters");
: ?>

Where did this name come from ("coaster_coasters")? I thought you said
the db name was "coasters".


--

This space not for rent.
Jul 17 '05 #3
>My domain: www.coaster.ch
My database: coasters
User: bettina

In the programm I wrote:

<?php
$db_server = "www.coaster.ch";
$db_name = "coasters";
$db_user = "bettina";
$db_passwort = "";
Why are you setting these variables if you are not using them?
$dbh = mysql_connect ("localhost", "coaster_bettina", "") or die ('I
You're using a blank password here; is that intended?
I doubt it.
cannot connect to the database because: ' . mysql_error());
mysql_select_db ("coaster_coasters");
That isn't the name of the database you claimed it was above.
?>

I get the following message:

Warning: mysql_connect(): Access denied for user
'coaster_bettina'@'localhost' (using password: YES) in
/home/coaster/public_html/connection.php on line 11
I cannot connect to the database because: Access denied for user
'coaster_bettina'@'localhost' (using password: YES)

I also tried with:

$db_name = "coaster_coasters";
$db_user = "coasters_bettina";
Since these variables are not used, who cares what you set them to?
What do I do wrong?
Here can I define a password for my database in phpMyAdmin?

Any help will be welcomed.


What is the actual user name you need to pass to MySQL?
You seem to be vascillating between "bettina" and "coasters_bettina".
Note that this may or may not have any relationship to what
you enter into some kind of "control panel" provided by your host.

What is the actual database name you need to pass to MySQL?
You seem to be vascillating between "coaster_coasters" and "coasters".

What is the actual host name you need to pass to MySQL?
You seem to be vascillating between "localhost" and "www.coaster.ch".
Even if these do refer to the same host, they are different from
the point of view of the MySQL permissions system.

What is the actual password you need to pass to MySQL? (don't
post the answer here!) My guess is that it's something besides
"".

Gordon L. Burditt
Jul 17 '05 #4
I created a database and called it "coasters" and a user called
"bettina"... the y will be shown afterwards as coaster_coasters and
coaster_bettina respectively.... I guess it is so because the domain is
"coaster"....

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Krista | last post: by
1 post views Thread by beck4353 | last post: by
3 posts views Thread by Raymond Chiu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.