用PHP连接MySQL代码的参数说明_php基础

WBOY
Release: 2016-05-17 09:36:44
Original
824 people have browsed it

代码是这样的:

$link=mysql_connect("localhost","root","123456"); 
if(!$link) echo "没有连接成功!"; 
else echo "连接成功!"; 
?>
    其中红色部分可以根据自己的实际情况进行修改。

localhost:表示数据库所在地。如果是本机,则写localhost,如果在其它机器上,则可写IP地址。 
root:进入数据库的用户名。MySQL默认用户名为root。 
123456:用户名所对应的密码。根据自己设的管理员密码修改这串数字。
    当然,所以以上提到的这些代码都是在配置好Apache + MySQL + PHP 之后才能运行成功的。请大家注意。
作者:Sunec
原载:Cenus Blog
版权所有。转载时必须以链接形式注明作者和原始出处及本声明。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!