You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用OpenServer本地服务器时无法连接MySQL及访问phpMyAdmin的求助

使用OpenServer本地服务器时无法连接MySQL及访问phpMyAdmin的求助

我正在用OpenServer作为本地服务器,但是遇到了两个棘手的问题:

  • 控制台连接MySQL失败
    不管我在控制台输入mysql、mysql -u root还是mysql.exe -uroot,都会弹出错误提示:

ERROR 1130 (HY000): Host 'localhost' is not allowed to connect to this MySQL server.

  • 无法访问phpMyAdmin
    同时我也进不去phpMyAdmin,我怀疑是自己不小心删掉了root用户导致的。

我尝试过修改config.inc.php文件,添加了以下配置:

$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root';
$cfg['Servers'][$i]['controlhost'] = '127.0.0.1';
$cfg['Servers'][$i]['controlport'] = 3306;
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = 'root';

但这么做完全没用,而且更麻烦的是,当我关闭OpenServer后,这个配置文件会被自动重置,我添加的代码直接就不见了。

有没有大佬能帮帮我解决这个问题?

备注:内容来源于stack exchange,提问作者Abduraxmon G'aybullayev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.23 07:48:15