无法从 WAMP 登录 MySQL,但可以登录 MariaDB
Posted
技术标签:
【中文标题】无法从 WAMP 登录 MySQL,但可以登录 MariaDB【英文标题】:Cannot login to MySQL from WAMP but login to MariaDB works 【发布时间】:2019-07-07 01:22:43 【问题描述】:我安装了 WAMP 并尝试登录 phpmyadmin。我无法登录 mysql,但可以登录 MariaDB。 我做了很多配置更改,但我无法登录。
$mariaFirst = ($wampConf['SupportMySQL'] == 'on' && $wampConf['SupportMariaDB'] == 'on' && $wampConf['mariaPortUsed'] == $wampConf['mysqlDefaultPort']) ? true : false;
if($wampConf['SupportMySQL'] == 'on')
/* Server: localhost [1] */
$i++;
if($mariaFirst) $i++;
$cfg['Servers'][$i]['verbose'] = 'MySQL';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = $wampConf['mysqlPortUsed'];
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root';
// Hidden databases in PhpMyAdmin left panel
//$cfg['Servers'][$i]['hide_db'] = '(information_schema|mysql|performance_schema|sys)';
// Allow connection without password
$cfg['Servers'][$i]['AllowNoPassword'] = true;
/* Server: localhost [2] */
if($wampConf['SupportMariaDB'] =='on')
$i++;
if($mariaFirst) $i -= 2;
$cfg['Servers'][$i]['verbose'] = 'MariaDB';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = $wampConf['mariaPortUsed'];
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root';
// Hidden databases in PhpMyAdmin left panel
//$cfg['Servers'][$i]['hide_db'] = '(information_schema|mysql|performance_schema|sys)';
// Allow connection without password
$cfg['Servers'][$i]['AllowNoPassword'] = true;
// Suppress Warning about pmadb tables
$cfg['PmaNoRelation_DisableWarning'] = true;
// To have PRIMARY & INDEX in table structure export
$cfg['Export']['sql_drop_table'] = true;
$cfg['Export']['sql_if_not_exists'] = true;
改了很多参数还是不能登录MySQL,但是可以登录MariaDB
【问题讨论】:
php 错误日志中的错误是什么?什么PHP版本?SHOW CREATE USER root
在 MySQL 上显示什么?
即使不输入密码也能登录 MariaDB
mysqli_real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO)
是什么让您认为 MySQL 和 MariaDB 服务器都在运行?
我正在尝试在 wamp 中登录 phpmyadmin,登录时我可以看到 mysql 和 mariadb 选项..Mariadb 不需要密码..mysql 在登录时出现错误
【参考方案1】:
伙计们,我找到了解决方案。我让 MySQL Workbench 使用相同的连接设置运行。所以我删除了那个连接,我可以在 WAMP 中使用 MySQL
【讨论】:
以上是关于无法从 WAMP 登录 MySQL,但可以登录 MariaDB的主要内容,如果未能解决你的问题,请参考以下文章