Home > Backend Development > PHP Tutorial > 请教:初次安装typecho,出现Error establishing a database connection,是怎么回事?

请教:初次安装typecho,出现Error establishing a database connection,是怎么回事?

WBOY
Release: 2016-06-06 20:30:28
Original
4283 people have browsed it

请教:初次安装typecho,出现Error establishing a database connection,是怎么回事?

如图所示
"Error establishing a database connection"报错的意思是"建立一个数据库连接错误"
请教下该怎么解决

回复内容:

请教:初次安装typecho,出现Error establishing a database connection,是怎么回事?

如图所示
"Error establishing a database connection"报错的意思是"建立一个数据库连接错误"
请教下该怎么解决

找了下代码,估计是你用户名、密码或者数据库名没有设置准确

<code>public function connect(Typecho_Config $config)
{
    if ($this->_dbLink = @mysql_connect($config->host . (empty($config->port) ? '' : ':' . $config->port),
    $config->user, $config->password, true)) {
        if (@mysql_select_db($config->database, $this->_dbLink)) {
            if ($config->charset) {
                mysql_query("SET NAMES '{$config->charset}'", $this->_dbLink);
            }
            return $this->_dbLink;
        }
    }

    /** 数据库异常 */
    throw new Typecho_Db_Adapter_Exception(@mysql_error($this->_dbLink));
}
</code>
Copy after login

来自 www.typechodev.com

@TypechoDev 请教:初次安装typecho,出现Error establishing a database connection,是怎么回事?

犯了一个错误,确实是我的用户名、密码或者数据库名没有设置准确,现在可以安装了,谢谢你

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