phpMyAdmin无法登录到Centos 7上的MySQL服务器 [英] phpMyAdmin Cannot log in to the MySQL server on Centos 7

查看:194
本文介绍了phpMyAdmin无法登录到Centos 7上的MySQL服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Nginx在Centos 7上安装了 mysql-community-server-8.0.13-1.el7.x86_64 ,并添加了phpMyAdmin来管理数据库,但是我一直收到错误消息 Cannot从phpMyAdmin登录到MySQL服务器.我已经尝试了以下方法,现在已经挣扎了几天:

I installed mysql-community-server-8.0.13-1.el7.x86_64 on Centos 7 with Nginx, and added the phpMyAdmin to manage the databases but I keep getting error Cannot log in to the MySQL server from phpMyAdmin. I've tried the following and have been struggling for a few days now:

  • 更改了位于/etc/phpMyAdmin/config.inc.php 上的某些参数(建议在stackoverflow上使用),如下所示,但没有运气:

  • Changed some of the parameters (suggested on stackoverflow) located on /etc/phpMyAdmin/config.inc.php like the following but no luck:

$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['socket'] = '/var/lib/mysql/mysql.sock';
$cfg['Servers'][$i]['user'] = 'root';          
$cfg['Servers'][$i]['password'] = 'password'; 

  • 我已经尝试了mysql shell,并且能够使用 root 和其他用户登录.但是,我不知道为什么它无法在phpMyAdmin上失败.请帮忙,谢谢!

  • I've tried mysql shell, and I'm able to login with root and other users. But, I have no idea why it fails on phpMyAdmin. Please help and thanks!

    推荐答案

    我能够通过执行以下操作来解决此问题:(我应该提到的是,该解决方案适用于MySQL 8.0.13和phpMyAdmin 4.8.4-两者均为最新版本)

    I was able to resolve this by doing the following: (I should mention that this solution works for MySQL 8.0.13 and phpMyAdmin 4.8.4 - Both, latest version today)

    1-我使用以下服务器参数(仅)编辑了 config.inc.php :

    1- I edited config.inc.php with these server parameters (only):

    /*** This is needed for cookie based authentication to encrypt password in 
    cookie. Needs to be 32 chars long. */
    $cfg['blowfish_secret'] = 'generate_your_blowfish_secret_32_chars'; 
    
    /* Authentication type */
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
    
    /* Server parameters */
    $cfg['Servers'][$i]['host'] = 'localhost';
    $cfg['Servers'][$i]['compress'] = false;
    $cfg['Servers'][$i]['AllowNoPassword'] = false;
    

    2-在MySQL终端上

    2- On MySQL terminal

    //Create a new user:
    mysql> CREATE USER 'user'@'localhost' IDENTIFIED BY 'your_password';
    
    //Grant all privileges:
    mysql> GRANT ALL PRIVILEGES ON *.* To 'user'@'localhost' WITH GRANT OPTION;
    
    //Flush all privileges:
    mysql> FLUSH PRIVILEGES;
    
    //Change authentication_string with password:
    mysql> ALTER USER user IDENTIFIED WITH mysql_native_password BY 
    'your_password';
    
    //Login with the new user and password!
    

    这应该允许您登录phpMyAdmin.希望对您有所帮助!

    This should allow you to login into phpMyAdmin. I hope this help!

    这篇关于phpMyAdmin无法登录到Centos 7上的MySQL服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆