-1

I have Centos 6 with MySQL 5.7 installed

when i restart computer and trying to access web site i recive next error:

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?

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

i checked:

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
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
Alexk
  • 1
  • 1
  • 1

2 Answers2

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.

Paulie-C
  • 1,674
  • 1
  • 13
  • 29
0

I Found the problem. RiggsFolly was right. the problem in local config. when HTTPD starts as service with boot that is limited environment and correct user required. when i make service restart after boot i logging in and service uses correct user environment and connects to MySQL as that user. so proper configuration of localconfig fixed the problem.

thanks to all of you.

Alexk
  • 1
  • 1
  • 1