View Full Version : newbie question about connecting to a mysql database

01-24-2005, 09:20 AM
I am trying to learn PHP and MySQL and need some help. In the PHP code
$connection = mysql_connect ("hostname", "username", "password") what do I use for hostname and which username and password is it referring to? I have installed PHPMyAdmin, mysql, and php from the site application section of my manager account. Is that all that I need to install or do I need to download and install apache on my machine? Any help here would be greatly appreciated. I feel kind of stupid asking this question as everyone here seems to know what they are doing but me :oops:

01-24-2005, 10:36 AM
hostname = localhost

You should have been prompted for a password when you set up mysql and that is your password

The default username = root

You can change both the username and password that you use by setting up a new user in phpMyAdmin if you want. You can actually create a user that can only use a specific database if you want which is what many folks do in order to protect the root user and password. That way you do not have to use that information in your scripts that may be viewable by others if you do not set up security in the correct method. Most scripts that you get have something to help keep this from happening but.... :)