Home >Backend Development >PHP Tutorial > 创设了两个Mysql数据库,php里却只能连接到一个

创设了两个Mysql数据库,php里却只能连接到一个

WBOY
WBOYOriginal
2016-06-13 13:15:30786browse

创建了两个Mysql数据库,php里却只能连接到一个
我在本地服务器创建了两个数据库,test 和 bbs
使用的时候只有test 可以连接上,bbs 连接不了

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->function db_connect()
{
   $db = @new mysqli("127.0.0.1", "developer", "123456", "test");
   if (!$db)
      return false;
   return $db;
}

上边这个可以连接到,下边这个却不可以
PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->function db_connect()
{
   $db = @new mysqli("127.0.0.1", "developer", "123456", "bbs");
   if (!$db)
      return false;
   return $db;
}



------解决方案--------------------
貌似是用户没权限。。
------解决方案--------------------
developer 用户没有操作 bbs 的权限,你应给给足权限。
Statement:
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