core 5 php mysql

Alexander Dalloz ad+lists at uni-x.org
Thu Jul 20 16:38:22 UTC 2006


Derek Hopkins schrieb:

>Hi List
>
>	Where can I find the right values to put in this piece of PHP code to
>link to MySQL.  At the moment if Can't Connect
>
><?
>$db_host = "localhost";
>$db_user = "mysql";
>$db_pass = "*****";
>$db_name = "scan2";
>
>$conn = mysql_connect($db_host,$db_user,$db_pass);
>if (!$conn) {
> echo "Could not connect to MySQL server!";
> exit;
>}
>
>I have hid the real value of the PW I think it is   Where can I find the
>values for each field on my system please.
>
Each system is itself "localhost". So you can leave / use that as $db_host.
The $db_user has to be created by the MySQL root user. Guess you are the 
MySQL admin, so you have to do that step your own. The MySQL docs 
instruct you about these basic steps. And most important: set a password 
for the MySQL root user! (From what you ask I assume you didn't so far.)
The $db_name is following your choice when creating a database within 
MySQL. If you already created DBs you then can find about them as MySQL 
root user using the "mysql" command line tool.

Alexander




More information about the fedora-list mailing list