2017-04-24 48 views
-1

我的Centos 6:阿帕奇不能安装</p> <p>的MySQL 5.7连接到MySQL

Software error:

Can't connect to the database. Error: Access denied for user ''@'localhost' to database 'bugzilla_DB' Is your database installed and up and running? Do you have the correct username and password selected in localconfig?

如果我连接到服务器

和重启HTTPD服务全部开始工作,直到下一次重新启动。

我检查:

1. mysql starts a lot before httpd 
2. waiting few minutes after server starts not help until i make httpd restart 
3. mysql.pid and mysql.sock are ok 
4. selinux disabled 
5. iptables not used and disabled 
6. no additional error in mysql.log 
+0

Apache通常不会连接到MYSQL – RiggsFolly

+0

'''@'localhost''看起来您并未在连接中设置USERID。空''''应该是一个用户名**检查你的localconfig ** – RiggsFolly

+0

当我使用相同的本地配置重新启动服务,它工作正常 – Alexk

回答

0

这似乎与你的网站的源代码试图访问MySQL。

您需要在源代码(无论进行身份验证)中输入正确的连接(主机和端口)信息和用户凭据。

这与Apache连接到MySQL无关(不稳定的前提)。它不(在任何正常的现成安装中)。

这是说,你还是应该提供更多的信息,下面的语句需要你安装更多的事实:

if i connect to server and restart HTTPD service all start working untill next restart.

0

我发现这个问题。里格斯福利是对的。在本地配置的问题。 当HTTPD作为服务启动时,启动即为有限的环境并且需要正确的用户。当我启动后服务重新启动后登录和服务使用正确的用户环境,并以该用户连接到MySQL。所以正确配置localconfig修复了这个问题。

感谢大家。