Topic on Project:Support desk

Jump to navigation Jump to search

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

Sriniu (talkcontribs)

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

Ciencia Al Poder (talkcontribs)

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).

Sriniu (talkcontribs)

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.

Ciencia Al Poder (talkcontribs)

Please, be sure that you've configured $wgDBpassword. It's not clear from your reply that you've done that. (talkcontribs)
    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.

Ciencia Al Poder (talkcontribs)

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. (talkcontribs)


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.

This post was posted by, but signed as 2A02:8108:2140:3D97:2480:6945:A181:17FA. (talkcontribs)

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.

Ciencia Al Poder (talkcontribs)

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. (talkcontribs)

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

Ciencia Al Poder (talkcontribs)

What solutions have you tried so far? (talkcontribs)

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.

Ciencia Al Poder (talkcontribs)

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. (talkcontribs)

Have you maybe moved the file into the includes/ directory? In this case moving it back might fix your problem... (talkcontribs)

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

Florianschmidtwelzow (talkcontribs)

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?) (talkcontribs)

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 (talkcontribs)

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!

AlphaCappa (talkcontribs)

I had the same issue and what i did is change the password of my user to something else.. oddly it managed to log in with the user. Im feeling its a bug..

Select your database and make sure you created the account as the people here above said it should (@localhost etc.) then change password and voila..

2601:9:5900:987:987F:AA76:333D:8875 (talkcontribs)

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. (talkcontribs)

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. (talkcontribs)

hi I have created a wiki via wiki media on local machine but some times it connect properly & sometimes it gives me an error : site cant be reached , localhost refused to connect.

This error is not permanent , i will not do anything & next time i may reopen my laptop it may work.

Please help

Salader (talkcontribs)

I know this was long ago, any way in case this is useful to anyone, as I was straggling 3 hours with the issue, if you are not able to connect to MySQL server from within the app with an error like:

Sorry! This site is experiencing technical difficulties.

Try waiting a few minutes and reloading.

Cannot contact the database server

and you're sure the credentials and db rights/grants are ok, try checking firewall and SELinux. In centos:

$ getenforce


$ setenforce 0

$ getenforce


This was my particular issue, SELinux was disabling local dir modifications and avoiding the app (mediawiki) connect MySQL server.