We help IT Professionals succeed at work.

mod_authn_dbd cannot connect to mysql

mark2326
mark2326 asked
on
602 Views
Last Modified: 2018-09-10
os: centos 7
apache 2.4.6
mysql 5.6.41

my configuration is in /etc/httpd/sites-enabled/mySite.com

<VirtualHost *:80>

DBDriver mysql
#DBDParams host=localhost,dbname=myDB,user=root,password=*****
DBDParams "dbname=myDB user=root password=*****"
#DBDParams host=localhost,dbname=myDB,user=root,password=*****,sock=/var/lib/mysql/mysql.sock

#DBDParams "host=127.0.0.1 port=3306 dbname=myDB user=root password=***** sock=/var/lib/mysql/mysql.sock"


DBDMin  4
DBDKeep 8
DBDMax  20
DBDExptime 300

<Directory "/path/to/Dir">

AuthDBDUserPWQuery "SELECT user_passwd FROM myTable WHERE user_name = %s"
#AuthDBDUserPWQuery "SELECT encrypt(user_passwd) AS password FROM myTable WHERE user_name = %s"
#<RequireAll>
  AuthType Basic
  AuthName "site"
 Require valid-user
     AuthBasicProvider socache dbd
 #   </RequireAll>
</Directory>

    ServerName www.mySite.com
    ServerAlias mySite.com
    DocumentRoot /Path/to/Dir
    ErrorLog /myPath/error.log
    CustomLog /myPath/requests.log combined

</VirtualHost>

Open in new window


After entering the username and password I get an "Internal Server Error" message.
My error log..

[Mon Sep 10 09:42:55.454763 2018] [dbd:error] [pid 32515] (20014)Internal error: AH00629: Can't connect to mysql: Access denied for user 'root'@'localhost' (using password: NO)
[Mon Sep 10 09:42:55.454833 2018] [dbd:error] [pid 32515] (20014)Internal error: AH00633: failed to initialise
[Mon Sep 10 09:42:55.454854 2018] [authn_dbd:error] [pid 32515] [client 69.92.163.194:40488] AH01653: Failed to acquire database connection to look up user 'mark'

Any ideas?
Thanks
Comment
Watch Question

Database Consultant
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Yes I am providing a password.
changing to ..
DBDParams "dbname=myDB user=root pass=*****"

Open in new window

The dialog keeps popping up saying "Incorrect user name or password"

log...
[Mon Sep 10 09:59:29.746818 2018] [auth_basic:error] [pid 9923] [client 127.0.0.1:46139] AH01617: user mark: authentication failure for "/myFile.pdf": Password Mismatch

The DBDParams are per apache's example.
Thanks
theGhost_k8Database Consultant
CERTIFIED EXPERT

Commented:
Can you confirm the connectivity works..
mysql -uUSER -pPASS

Author

Commented:
yes using..
 mysql -u root p- *****

connects

Author

Commented:
It turns out you were correct, it is pass= and not password=
After thinking about it, I wasn't getting connection errors anymore.
I changed...
AuthDBDUserPWQuery "SELECT user_passwd FROM myTable WHERE user_name = %s"

Open in new window

to
AuthDBDUserPWQuery "SELECT encrypt(user_passwd) AS password FROM myTable WHERE user_name = %s"

Open in new window


Seems to be working
Thanks

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.