Jump to content

Topic on Project:Support desk/Flow

MediaWiki 1.20.2 installation

7
86.7.22.164 (talkcontribs)

Am trying to install MediaWiki 1.20.2

I create a new db called db_wikimedia via my web host and set up an admin user called db_wiki_admin and put these details in the install script but at the final step it fails with:

Setting up database... A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
 CREATE DATABASE `db_wikimedia`
 from within function ‘MysqlInstaller::setupDatabase.’ Database returned error ‘1044: Access denied for user 'db_wiki_admin'@'%' to database 'db_wikimedia' (localhost).’
Backtrace:

#0 /var/www/vhosts/smoketest.info/wiki/includes/db/Database.php(916): DatabaseBase->reportQueryError('Access denied f...', 1044, 'CREATE DATABASE...', 'MysqlInstaller:...', false)
 #1 /var/www/vhosts/smoketest.info/wiki/includes/installer/MysqlInstaller.php(469): DatabaseBase->query('CREATE DATABASE...', 'MysqlInstaller:...')
 #2 [internal function]: MysqlInstaller->setupDatabase(Object(MysqlInstaller))
 #3 /var/www/vhosts/smoketest.info/wiki/includes/installer/Installer.php(1454): call_user_func(Array, Object(MysqlInstaller))
 #4 /var/www/vhosts/smoketest.info/wiki/includes/installer/WebInstallerPage.php(1161): Installer->performInstallation(Array, Array)
 #5 /var/www/vhosts/smoketest.info/wiki/includes/installer/WebInstaller.php(269): WebInstaller_Install->execute()
 #6 /var/www/vhosts/smoketest.info/wiki/mw-config/index.php(50): WebInstaller->execute(Array)
 #7 /var/www/vhosts/smoketest.info/wiki/mw-config/index.php(18): wfInstallerMain()
 #8 {main} 

Why should it be trying to create a database that I've already created and told it about. What am I missing? Should I be configuring this some other way?

Thanks

David

PS Since I am new to Wikis, how do I embed code (or, rather, the error message as pasted in above) to make it render correctly? I was looking for some tags but don't know where to start. :o(

88.130.81.134 (talkcontribs)

Hi David!

MySQL error 1044 points to missing permissions. You have to give the MySQL user (in your case "db_wiki_admin") permission to manipulate the database "db_wikimedia". That is possible with the following SQL query:

 GRANT ALL ON db_wikimedia.* TO 'db_wiki_admin'@'localhost' IDENTIFIED BY 'password';

where "password" is the user's password. If you have phpmyadmin available, you can also use its interface to set the permissions.

Manual:Errors_and_symptoms has more information on MySQL errors.

86.7.22.164 (talkcontribs)

Thanks but a SHOW GRANTS from phpMyAdmin shows that the db user I have configured already has all the permissions granted:

GRANT USAGE ON *.* TO 'db_wiki_admin'@'%' IDENTIFIED BY PASSWORD
'*5B1CB32E845DFF8B8CE8EBCEC2B5265E53652A88'

GRANT ALL PRIVILEGES ON `db\_mediawiki`.* TO 'db_wiki_admin'@'%'
86.7.22.164 (talkcontribs)

Just to add a bit more info...

The error says Access Denied but I feel that this is a red herring since I can only create databases through Plesk and I don't have permission to CREATE DATABASE but I can pretty much do everything else. In fact, I can get into my database via phpMyAdmin and create tables in the db without problem.

Looking at the code (and I am just a novice at PHP), it seems to be falling over at the function setupDatabase() in MysqlInstaller.php. If getConnection() results in success, the funtion appears to return but, if not, it tries to create the database with CREATE DATABASE. So, I assume that MediaWiki think my connection credentials are wrong but I've double-checked these - my host is localhost and I specify the correct database name and the database username and password are the same as those I use in Plesk and phpMyAdmin to administer the database.

If I deliberately set a wrong password in the Connect to database setup screen, it gives me a DB connection error and won't let me proceed to the next screen but the correct password takes me to the Database settings screen suggesting that the connection is valid. So, why does it then appear to fail later on in the setup script?

Any thoughts?

MarkAHershberger (talkcontribs)

Maybe you're running into some sort of connection limit so that the connection before it tries to create the database fails?

That sounds really strange to me, but I can't think of any other reason it would fail like that. Have you tried contacting your web host about this?

Since it sounds like you can read code well enough, try modifying it by putting var_dump() in various places so you can see what is actually being returned and why it thinks it needs to create the database.

86.7.22.164 (talkcontribs)

Thanks Mark. I've done a little probing in the code with print_r and it's failing in the function setupDatabase() in MysqlInstaller.php. It seems to be looking for selectDB in the $conn array and not finding it. $conn is set by the $value field returned by getConnection() and it appears to be missing selectDB although $this->getVar( 'wgDBname' ) returns the correct db name. So, it has the right database name, just not having the name set in all the right places it seems.

I'm afraid I'm not php savvy enough to probe further. :o(

I don't think it's anything to do with connection limits. I had TikiWiki up and running on this server fine and everything else I've tried installs dead easy. I might have to knock MediaWiki on the head and try phpWiki next. I'm just trying to find some easy-to-use Wiki system with user permissions just to get a documentation project off the ground and I don't have a lot of time to tinker around.

Thanks

David

MarkAHershberger (talkcontribs)

Thanks for the digging! I'll look at the code and try and see why it wouldn't return selectDB in $conn.

I'd like to help you get this fixed so that you can use MW. Feel free to contact using the "E-mail this user" feature or ping me -- hexmode -- on IRC.