Parameters for connecting to MySQL code using PHP. The code is as follows :? Php $ linkmysql_connect (localhost, root, 123456); if (! $ Link) echo no connection successful !; Elseecho connection successful !;? The red part of the code is as follows:
$ Link = mysql_connect ("localhost", "root", "123456 ");
If (! $ Link) echo "no connection successful! ";
Else echo "connection successful! ";
?>
The red part can be modified based on your actual situation.
Localhost: indicates the database location. If it is a local machine, enter localhost. if it is on another machine, enter an IP address.
Root: enter the username of the database. The default username of MySQL is root.
123456: password corresponding to the user name. Modify the numbers according to the administrator password.
Of course, the code mentioned above is successful only after Apache + MySQL + PHP is configured. Please note.
By Sunec
Original load: Cenus Blog
Copyright. The author and original source and this statement must be indicated in the form of links during reprinting.
Why :? Php $ link = mysql_connect ("localhost", "root", "123456"); if (! $ Link) echo "no connection successful! "; Elseecho" connection successful! ";? The red part can be based on your own real...