Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
fuzzyfuzz
Forum Newbie
Posts: 10 Joined: Fri Dec 05, 2008 5:07 pm
Post
by fuzzyfuzz » Sun Dec 07, 2008 12:44 pm
hi everyone;
I'm getting started with php and mysql. I have a problem with connecting from my php script to mysql server - please check up this code:
Code: Select all
<?php
// Make a MySQL Connection
$link= mysql_connect("localhost","","") or die(mysql_error());
echo "connected successfully to MySQL server.";
mysql_close($link);
?>
I'm reciveing the folowing messege: accec is denied [password:no]
I don't use any user name or password to log into the mysqlserver since it id instaleed on my pc
Please help me
fuzzyfuzzzz
alex.barylski
DevNet Evangelist
Posts: 6267 Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg
Post
by alex.barylski » Sun Dec 07, 2008 12:50 pm
Are you using XAMPP?
Can you login into the mysql console with no user or pass?
fuzzyfuzz
Forum Newbie
Posts: 10 Joined: Fri Dec 05, 2008 5:07 pm
Post
by fuzzyfuzz » Sun Dec 07, 2008 12:53 pm
yes u can access the console. i'm using wampserver
alex.barylski
DevNet Evangelist
Posts: 6267 Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg
Post
by alex.barylski » Sun Dec 07, 2008 1:13 pm
I have never used wampserver...
You are sure did not specify a username/password when setting up the system?
Are you sure the mysql service is running?
fuzzyfuzz
Forum Newbie
Posts: 10 Joined: Fri Dec 05, 2008 5:07 pm
Post
by fuzzyfuzz » Sun Dec 07, 2008 1:21 pm
How do i know what is mysql server's name? is it always host? or local host?
because it is posiible to connect through the consloe
alex.barylski
DevNet Evangelist
Posts: 6267 Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg
Post
by alex.barylski » Sun Dec 07, 2008 4:38 pm
In your case it's likely 'localhost' is the host name...
hemraj
Forum Newbie
Posts: 11 Joined: Mon Dec 08, 2008 1:05 am
Post
by hemraj » Mon Dec 08, 2008 1:08 am
fuzzyfuzz wrote: yes u can access the console. i'm using wampserver
saASsSas
fuzzyfuzz
Forum Newbie
Posts: 10 Joined: Fri Dec 05, 2008 5:07 pm
Post
by fuzzyfuzz » Mon Dec 08, 2008 12:29 pm
here is the code
Code: Select all
<?php
$mysql_link= mysql _connect('localhost','','') or die("ERROR:cannot connect");
echo "connected successfully to MySQL server.";
mysql_close($mysql_link);
?>
what's wrong with it?
10x.
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Mon Dec 08, 2008 3:42 pm
This sure does look like a
Databases question.
Moving to the appropriate forum.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.