Topic on Project:Support desk

Cannot contact the database server: Access denied for user

17
35.20.11.95 (talkcontribs)

So I upgraded the mediaWiki version by overwriting the old version with new version. I upgraded from 1.22.6 to 1.23.5. But as soon as I overwrote the directory and tried to open the website on web browser, I got :

(Cannot contact the database server: Access denied for user 'newqmrasite'@'localhost' (using password: YES) (localhost))

PLEASE HELP!!!!!!

Florianschmidtwelzow (talkcontribs)

Hello!

This is an issue of your configuration :) Please check, if the username and password of your database user (which has access to the database you want to use) is correctly written and is valid (maybe, try to login with these data from the console, if possible).

35.20.11.95 (talkcontribs)

Thanks for the reply! I have tried that already. The servername, database name, user and password are all correct in localsettings. I have changed the password for the user through phpmyadmin and updated it in localsettings but I keep getting the same message.

Somebody please help me out! My job depends on it!

88.130.93.83 (talkcontribs)

Overwriting an old wiki version with the files from a newer tarball does not touch LocalSettings.php. If it worked before and does not work now, then you must have changed something with LocalSettings.php. What did you do? Have you recreated the file?

Anyway, what you can do is to put the following lines at the very bottom of your LocalSettings.php file:

echo $wgDBserver . "\n";
echo $wgDBname . "\n";
echo $wgDBuser . "\n";
echo $wgDBpassword . "\n";
die("END");

This will put out the according information onto the wiki page (do not forget to remove them again afterwards!). Is this information - all four of them - correct?

69.176.157.101 (talkcontribs)

Thanks a lot for the reply!

I pasted the code at bottom of localsetting.php. It printed out the correct information. But still I am still getting the same error. Here's website qmrawiki.canr.msu.edu

I will be forever thankful to you if you help me out!!!

Florianschmidtwelzow (talkcontribs)

For this page i get the following error:

ERROR: Semantic MediaWiki must be installed for Semantic Forms to run!

???

Can you try the following?:

  1. Create a new file called test.php (e.g. test, you can choose any other name, if you want, with the file extension php)
  2. Insert the following, save and upload to your webspace:
<?php
$wgDBserver = 'localhost';
$wgDBuser = 'newqmrasite';
$wgDBpassword = '';
$wgDBname = '';

$mysqli = new mysqli( $wgDBserver, $wgDBuser, $wgDBpassword );

if ( mysqli_connect_errno() ) {
    die( "Failed:" . mysqli_connect_error() );
}

if ( $mysqli->select_db( $wgDBname) ) {
    echo 'Connected and DB selected.';
} else {
    echo 'Something went from (select_db())';
}

$mysqli->close();

Insert the correct data for server, username and password!

If you transferred the file to your server, open it in your webbrowser and give us the output :)

35.9.30.13 (talkcontribs)

Thanks for the reply. Here's the output

Warning: mysqli::mysqli(): (28000/1045): Access denied for user 'wikiuser'@'localhost' (using password: YES) in /home/qmrawikiuser/public_html/qmrawiki.canr.msu.edu/wiki/test1.php on line 7 Failed:Access denied for user 'wikiuser'@'localhost' (using password: YES)

Again I really appreciate the help!

Florianschmidtwelzow (talkcontribs)

Why are the usernamens different? (First error message's username: newqmrasite, Username of the second one: wikiuser). Are you sure, that the mysql server (which you can administrate via phpmyadmin) is the same as the server PHP is trying to connect to as localhost?

88.130.93.83 (talkcontribs)

While I - just like Florian - see the error message about Semantic Forms, this is not the initial issue.

The error "Access denied for user 'username'@'hostname'" is caused be incorrect credentials. For example I see that you are using two different MySQL usernames: You used "newqmrasite" in your first post, but now you use "wikiuser". Again, please make sure that you are using the correct username!

@ Florian: Is it intended that in your script you are not defining $wgDBname (while you are later using it)?

35.9.30.13 (talkcontribs)

No I haven't been able to actually. It seems like I am not able to connect to the specific database, I am trying to connect to but I can connect other databases. I have changed the password for that database and then try to connect but it still fails.

PLEASE PLEASE help!!!!

88.130.93.83 (talkcontribs)

You cannot connect to one database while you can connect to another? That is not possible in your situation. Your error clearly states that your username and password are incorrect so that the login fails. This has nothing to do with access to a certain database - without working login you won't be able to access any database.

69.176.157.101 (talkcontribs)

I understand what you're saying but I have tried connecting to the database which was configured in the localsettings already before I updated the version but it gives me this error: "Access denied for user 'qmrawiki'@'localhost' (using password: YES)". I have checked and rechecked the DBname, DBserver, DBuser, DBpassword they are all correct. When I change the DBname, DBuser, DBpassword to some other database under the same host name, it connects. I have even changed the password, from phpmyadmin using root, for the user under the database I am trying to connect to and have also changed the password in localsettings BUT it still doesn't work.

I appreciate you taking the time to help another human being. Thank you!

88.130.93.83 (talkcontribs)

"qmrawiki" now is the third username, which you are using.

Anyway, are you able to log in with one of them through phpmyadmin?

69.176.157.101 (talkcontribs)

I can login to phpmyadmin but it gives me this error "#1142 - SELECT command denied to user 'qmrawiki'@'localhost' for table 'pma_column_info' "

Any suggestions?

88.130.114.167 (talkcontribs)
Florianschmidtwelzow (talkcontribs)

Can you check, if the user is allowed to connect to your host (phpmyadmin -> host field)?

Florianschmidtwelzow (talkcontribs)

> @ Florian: Is it intended that in your script you are not defining $wgDBname (while you are later using it)?

Oops, no, that's an error, fixed. Thanks :)

Reply to "Cannot contact the database server: Access denied for user"