Home > Backend Development > PHP Tutorial > 关于连接数据库

关于连接数据库

WBOY
Release: 2016-06-23 13:50:05
Original
821 people have browsed it

<?php                $link = mysqli_connect(                   'localhost',  /*  连接MySQL地址 */                   'root',      /* 连接MySQL用户名 */                   '""',  /*  连接MySQL密码 */                  'db_test');    /* 连接数据库名称*/             	 if (!$link) {         	 printf("Can't connect to MySQL Server. Errorcode: %s ", mysqli_connect_error());        	 exit;      	 }   ?>
Copy after login


这样可有比对的地方么?


回复讨论(解决方案)

只要口令正确,数据库存在
没有问题

只要口令正确,数据库存在
没有问题


感谢版主。我发现问题了。那个密码,我没设置密码,但是还是写了双引号。所以链接不上。我以为双引号表示没密码的意思。
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