MySQL Forums
Forum List  »  PHP

php mysql connection help..
Posted by: Dragon Knight
Date: June 04, 2005 01:50PM

i recently installed php and mysql
I'm a newbie to this so I don't know much

how do I connect mysql database in php code?

i read articles about how to connect and I do not understand it..

$link = mysql_connect('mysql_server', 'mysql_username', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
echo 'Connected successfully';

now I do this on my localhost and the port is 3306

so I suppose that I replace mysql_server with localhost:3306?

I don't know what the username is...when I install mysql there wasn't a username...

whenever I access mysql using mysql.exe, I use the password 12345
so is it that I replace mysql_password with 12345?

please help...this is the first step and I'm stuck...

Options: ReplyQuote

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.