I have a phpMyAdmin folder. So first I set .htaccess folder and type this in it.
AuthUserFile /var/www/html/phpMyAdmin-3.4/.htpasswd
AuthName "phpMyAdmin Login Page"
AuthType Basic
Require valid-user
The I created the username and password using this command
sudo htpasswd -c .htpasswd iamadmin
...and I could see both the .htaccess and .htpasswd files are in the folder. But when I go my link it never prompt for the additional username and password. My OS is centos 6.2
You will most likely need to configure your server to allow
AuthConfig
directives in.htpasswd
files. Add anin a suitable place in your httpd configuration (/etc/httpd/conf/httpd.conf) file and restart apache
See also the apache docs
If this not working there is problem with your
.htaccess
file.