无法使用 root 用户登录 phpmyadmin

2022-01-05 00:00:00 ubuntu php phpmyadmin ubuntu-17.04

我在 Ubuntu 系统中无法使用 phpmyadmin 登录.

I am having trouble to login to with phpmyadmin in Ubuntu system.

用户名 - root密码 - 空

Username - root Password - empty

但它仍然显示如下错误

 #1045 - Access denied for user 'root'@'localhost' (using password: NO)

帮我解决谢谢.

推荐答案

我用以下步骤解决了它:

I sloved it with below steps:

1) 打开config.inc.php文件

2) 更改文件写入权限

2) Change file permition to write

sudo chmod 777 /etc/phpmyadmin/config.inc.php

3) 将以下行添加到文件中

3) Add below line to the file

 $cfg['Servers'][$i]['user'] = 'root';
 $cfg['Servers'][$i]['password'] = 'MY_SQL ROOT_USER_PASSWORD';
 $cfg['Servers'][$i]['AllowNoPassword'] = true;

4) 再次将文件parmission更改为原始

4) Change file parmissions to original again

 sudo chmod 755 /etc/phpmyadmin/config.inc.php

5) 重启服务器

service mysql start or service mysql start

6) 打开

http://localhost/phpmyadmin
username: root
password: YOUR_MYSQL'S ROOT USER'S PASSWORD

  • 已成功登录到 phpmyadmin.

相关文章