Jac*_*man 2 nginx phpmyadmin centos7 mysql-8.0
我mysql-community-server-8.0.13-1.el7.x86_64在 Centos 7 上安装了 Nginx,并添加了 phpMyAdmin 来管理数据库,但我不断收到Cannot log in to the MySQL server来自 phpMyAdmin 的错误消息。我已经尝试了以下方法并且已经挣扎了几天:
更改了位于/etc/phpMyAdmin/config.inc.php如下所示的一些参数(在stackoverflow上建议),但没有运气:
$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';
Run Code Online (Sandbox Code Playgroud)我已经尝试过 mysql shell,我可以root和其他用户一起登录。但是,我不知道为什么它在 phpMyAdmin 上失败了。请帮助和感谢!
我能够通过执行以下操作来解决这个问题:( 我应该提到这个解决方案适用于 MySQL 8.0.13 和 phpMyAdmin 4.8.4 - 两者都是今天的最新版本)
1-我config.inc.php使用这些服务器参数进行了编辑(仅):
/*** 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;
Run Code Online (Sandbox Code Playgroud)
2- 在 MySQL 终端上
//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!
Run Code Online (Sandbox Code Playgroud)
这应该允许您登录到 phpMyAdmin。我希望这有帮助!
| 归档时间: |
|
| 查看次数: |
10745 次 |
| 最近记录: |