Can't contact the database server: Access denied for user 'wikiuser'@'localhost' (using password: NO) (localhost))

Jump to: navigation, search

Hi All,

I have installed the mediawiki in Redhat linux environment and all the installation with configuration are went fine, but in the end when I tried to access the mediawike i getting below error message:

Can't contact the database server: Access denied for user 'wikiuser'@'localhost' (using password: NO) (localhost)) I am not sure what was the problem i was able to login as wikiuser at wikidb (database).

Can someone help me what will be the issue and where I am wrong.

thanks in advance.

best Regards

Sriniu (talk)18:24, 29 October 2012

The error message states that you're trying to connect to the database in localhost using the 'wikiuser' user account but without specifying a password.

Be sure you specify a valid password for connecting to the database (configured in LocalSettings.php).

Ciencia Al Poder (talk)10:18, 30 October 2012

thanks for your reply.

yes i have give wikiuser password only. i tried to login in mysql with wikiuser and its password and it is working fine.

but not sure i am getting access denied error for wikiuser.

Sriniu (talk)20:43, 30 October 2012

Please, be sure that you've configured $wgDBpassword. It's not clear from your reply that you've done that.

Ciencia Al Poder (talk)19:57, 31 October 2012
    1. Database settings

$wgDBtype = "mysql"; $wgDBserver = "localhost"; $wgDBname = "wikidb"; $wgDBuser = "wikiuser"; $wgDBpassword = "wikiuser";

just want to recheck with you, i have copied LocalSettings.php file under /var/www/devwiki/ path, is it ok?

because all the mediawiki folder and files are under devwiki., 2 November 2012

Those settings seem okay.

Maybe the problem is the user. Note that on mysql the user is also associated to a host (localhost in this case). Try resetting the password:

You should do that for 'wikiuser'@'localhost', 'wikiuser'@'%' and 'wikiuser'@'yourhost', where "yourhost" is the hostname of the database.

Ciencia Al Poder (talk)10:20, 2 November 2012


I also get:

(Can't contact the database server: Access denied for user 'wikiuser'@'localhost' (using password: NO) (localhost))

The reason is that the LocalSettings.php is not honored.

I am on a debian wheezy and my version of mediawiki is: 1:1.19.18+dfsg-0+deb7u1

If I enter the database access information into the /usr/share/mediawiki/includes/DefaultSettings.php file things are working at least for the database connection. Then the next things starts failing.

Please make sure you are editing the correct LocalSettings.php file! Maybe you also have some symlinks in place, which break the setup: Usually MediaWiki has to be installed somewhere in the webroot folder, which usually is /var/.../www/. You however, seem to use it from /usr/share/, which means that you somehow have to make these files accessable to the outside world. I think the way you do this is part of the problem., 30 August 2014

In Debian, LocalSettings.php is apparently installed in /var/lib/mediawiki/config/LocalSettings.php or /etc/mediawiki/LocalSettings.php, or there's a symlink between both.

Ciencia Al Poder (talk)17:27, 31 August 2014

I am getting the same error message. Were you ale to resolve this issue. The mediawiki upgrade is taking more time than actually creating new wiki and getting new domain name :(

- KT, 7 October 2014

What solutions have you tried so far?

Ciencia Al Poder (talk)09:17, 7 October 2014

Thank you for your response. My mediawiki is installed on Dreamhost with PHP5.2. I was trying to upgrade the mediawiki to newer version and so I upgraded my PHP to 5.4 and when I ran the update.php command it gave me error. My Localsettings.php is installed in wiki2\includes folder and I did verified my password and its is correct.

KT02:23, 8 October 2014

That doesn't seem correct. Your LocalSettings.php is usually placed in the MediaWiki installation folder, not inside "includes". Please check that a LocalSettings.php exists on your installation directory (and not in any subdirectory) and that database settings are correct.

Ciencia Al Poder (talk)09:36, 8 October 2014

Have you maybe moved the file into the includes/ directory? In this case moving it back might fix your problem..., 8 October 2014

My apologies but LocalSettings.php is in the MediaWiki installation folder, not inside "includes". I got confused with the DefaultSettting. Also the Dbuser, Dbpassword and server are all correct. I tried them on my SQL and they work fine.

- KT, 9 October 2014

Can you check, if the username written in the error message, is the same, like the one you wrote in your LocalSettings.php? (And it's really exact the same error message like the one in the thread title?)

Florianschmidtwelzow (talk)08:37, 9 October 2014
Edited by another user.
Last edit: 13:57, 9 October 2014

This is the error I get==> (Can't contact the database server: Access denied for user ''@'' (using password: NO) (

I looked into username in Localsettings and that is the correct one. I am not sure where the update.php is picking ''@'' from since the LocalSettings.php has the correct credentials.

-KT, 9 October 2014

Your error message shows that MediaWiki does not(!) use any username. Please check that $wgDBuser is spelled and written correctly!

When you are at it, please verify that "" is the correct value for $wgDBserver!, 9 October 2014

Hi there. I am getting this error:

DB connection error: Access denied for user 'livinhp8_wiki'@'' (using password: YES) (

Check the host, username and password and try again.

Not sure what I am doing wrong. Username, password and permissions are fine.

2601:9:5900:987:987F:AA76:333D:887519:24, 21 November 2014

Your error message shows that MediaWiki uses the MySQL username "livinhp8_wiki" as $wgDBuser. When you are at it, please verify that "" is the correct value for $wgDBserver! Also the name of the DB must be correct.

Finally a

GRANT ALL PRIVILEGES ON database_name TO user@host IDENTIFIED BY 'password';

in MYSQL should give the according rights and clear the priv cache., 21 November 2014