我安装了带有MySQL 5.7的Centos 6
当我重新启动计算机并尝试访问网站时,我发现了下一个错误:
软件错误:
无法连接到数据库。 错误:用户''@ localhost'拒绝访问数据库'bugzilla_DB' 您的数据库是否已安装并正常运行? 您是否在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 :(得分:0)
This seems to be related to your web site source code trying to access MySQL.
You need to enter the right connection (host and port) info and user credentials in your source code (wherever authentication is made).
This has nothing to do with (the erratic premise) that Apache connects to MySQL. It does not (in any normal out-of-the box installation).
This being said, you should still provide more information, the following statement requires more facts about your setup:
if i connect to server and restart HTTPD service all start working untill next restart.
答案 1 :(得分:0)
我发现了问题。 RiggsFolly是对的。本地配置中的问题。 当HTTPD作为服务启动时,启动是有限的环境和正确的用户需求。当我启动后重新启动服务时我登录并且服务使用正确的用户环境并以该用户身份连接到MySQL。所以localconfig的正确配置解决了这个问题。
谢谢你们所有人。