Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用户的MySQL访问被拒绝';根'@';本地主机';错误_Mysql - Fatal编程技术网

用户的MySQL访问被拒绝';根'@';本地主机';错误

用户的MySQL访问被拒绝';根'@';本地主机';错误,mysql,Mysql,我刚刚在CentOS 7上安装了MySQL 5.7,并且配置了root密码 mylocalhost上的MySQL登录成功,如下所示 [root@test]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 34 Server version: 5.7.30 MySQL Community Server (GP

我刚刚在CentOS 7上安装了MySQL 5.7,并且配置了root密码

mylocalhost上的MySQL登录成功,如下所示

[root@test]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 34
Server version: 5.7.30 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Access denied for user 'root'@'localhost' (using password: NO)
The database connection failed: the host or super user parameters must be wrong.
然而,我需要连接到MySQL的web应用程序如下所示

[root@test]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 34
Server version: 5.7.30 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Access denied for user 'root'@'localhost' (using password: NO)
The database connection failed: the host or super user parameters must be wrong.
mysqld.log说

2020-06-26T05:31:47.878390Z 27 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2020-06-26T05:36:12.328126Z 28 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2020-06-26T05:53:18.872033Z 29 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2020-06-26T05:53:35.232340Z 30 [Note] Access denied for user 'root'@'localhost' (using password: NO)
2020-06-26T06:06:34.293625Z 35 [Note] Access denied for user 'root'@'localhost' (using password: NO)
密码正确,是新安装的MySQL。 我尝试了mysqld_safe——跳过授权表来删除我的密码,它在没有密码的情况下工作,但sql脚本无法运行。 因此,出于安全目的,需要进行密码配置

phpmyadmin可以使用相同的MySQL ID和PW访问

这会是web应用程序的问题吗?(但我对此表示怀疑,因为这是一个初始设置阶段)还是我可以在MySQL方面做些什么


谢谢,

尝试重新安装mysql并添加另一个用户,例如
创建由“123”标识的用户“webuser”@“localhost”
@Mantykora7谢谢您的评论。然而,我已经重新安装了三次,它必须是“根”。我假设这个错误消息不应该说“使用密码:否”。应该是是的,因为我输入了密码。这是一台虚拟机?@Mantykora7是的,它在公共云上。Selinux和防火墙都已关闭。您可以安装其他软件进行测试吗?例如ubuntu服务器。你试过sudo su然后>mysql吗?