quanshiyinian 发表于 2020-10-25 10:37:46

访问网站的时候出现Discuz! Database Error (2002) notconnect错误的解决方法

自己用dz做的网站一直好好的,今天访问的时候出现了:Discuz! Database Error (2002) notconnect错误,如图:

解决方法:修改/config/config_global.php中的<span class="MathJax" id="MathJax-Element-31-Frame" tabindex="0" data-mathml="config[&#x2018;db&#x2032;][&#x2018;1&#x2032;][&#x2018;dbhost&#x2032;]=&#x2018;localhost&#x2032;;&#x6539;&#x4E3A;&#xFF1A;" role="presentation" style="box-sizing: border-box; outline: 0px; display: inline; line-height: normal; word-spacing: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">config[‘db′][‘1′][‘dbhost′]=‘localhost′;改为:config[‘db′][‘1′][‘dbhost′]=‘localhost′;改为:_config[‘db’][‘1’][‘dbhost’] = ‘127.0.0.1’;修改/uc_server/data/config.inc.php下的define(‘UC_DBHOST’, ‘localhost’);
改为:define(‘UC_DBHOST’, ‘127.0.0.1’);我的数据库和程序是在同一台服务器的,将地址从localhost改为127.0.0.1即可(不知道为啥子不能用localhost),也可以改为数据库所在的服务器的ip地址。注:这种都是连接数据库出错造成的,可以检查连接地址、数据库用户名、密码等是否正确。这样就可以了
页: [1]
查看完整版本: 访问网站的时候出现Discuz! Database Error (2002) notconnect错误的解决方法