# Mediawiki database gone after mysql rebuild

## Warhead

I switched to the latest gcc, so I had to rebuild my packages. Having that done,  however, my mediawiki does not exist anymore. This is what my browser states:

```

Error in fetchObject(): Table 'wikidb.page' doesn't exist

Backtrace:

    * GlobalFunctions.php line 602 calls wfBacktrace()

    * Database.php line 596 calls wfDebugDieBacktrace()

    * Database.php line 1787 calls Database::fetchObject()

    * LinkBatch.php line 76 calls ResultWrapper::fetchObject()

    * LinkBatch.php line 55 calls LinkBatch::executeInto()

    * Skin.php line 192 calls LinkBatch::execute()

    * Skin.php line 171 calls Skin::preloadExistence()

    * SkinTemplate.php line 108 calls Skin::initPage()

    * MonoBook.php line 28 calls SkinTemplate::initPage()

    * SkinTemplate.php line 151 calls SkinMonoBook::initPage()

    * OutputPage.php line 582 calls SkinTemplate::outputPage()

    * OutputPage.php line 799 calls OutputPage::output()

    * Database.php line 476 calls OutputPage::databaseError()

    * Database.php line 419 calls Database::reportQueryError()

    * Database.php line 806 calls Database::query()

    * Database.php line 825 calls Database::select()

    * JobQueue.php line 47 calls Database::selectRow()

    * Wiki.php line 289 calls Job::pop()

    * Wiki.php line 247 calls MediaWiki::doJobs()

    * index.php line 124 calls MediaWiki::finalCleanup()

```

How does a rebuild of mysql remove a database? I am puzzled...please enlighten my.

Regards

Warhead

----------

## Janne Pikkarainen

Are you sure the database is actually removed? What could have happened is that your old database is still in /var/lib/mysql/ and your new upgraded version uses /var/lib/mysql-500 or so...

Is the database visible via some other method, like command-line mysql client?

----------

## Warhead

Hmm...thanks for the advice, I thnik I discoverd something strange. In /var/lib/mysql there is a wikidb directory an anoter mysql directory...

But I do not know, if that causes the error, nor how to fix it

Regards

Warhead

----------

## Janne Pikkarainen

Well, can you see the database with command-line MySQL client?

```
mysql -u root -p

USE wikidb;

SHOW TABLES;

quit
```

If not, then you might want to stop MySQL, move your wikidb directory from /var/lib/mysql/mysql/wikidb to /var/lib/mysql/wikidb and restart MySQL. Naturally you have backups made before you try anything like this, though this should be safe.

And check file permissions, too: make sure mysql user has permissions to your database.

----------

## Warhead

It seams the database ist still there:

```

mysql> SHOW TABLES;

+------------------+

| Tables_in_wikidb |

+------------------+

| archive          |

| blobs            |

| brokenlinks      |

| categorylinks    |

| cur              |

| hitcounter       |

| image            |

| imagelinks       |

| interwiki        |

| ipblocks         |

| links            |

| linkscc          |

| logging          |

| math             |

| objectcache      |

| old              |

| oldimage         |

| querycache       |

| recentchanges    |

| searchindex      |

| site_stats       |

| user             |

| user_newtalk     |

| user_rights      |

| validate         |

| watchlist        |

+------------------+

26 rows in set (0.00 sec)

mysql>

```

So the MediaWiki uses a wrong path? This is confusing...

Regads 

Warhead

----------

## Janne Pikkarainen

Another two guesses:

- Your mediawiki config file has been replaced with default one.

- Your PHP has been recompiled without mysql USE flag and now it's completely missing MySQL support, and MediaWiki just decides to throw a very misleading error. Check with emerge -pv dev-lang/php.

- Your mediawiki user account in MySQL is not there anymore and mediawiki doesn't have access to database for that reason.

----------

## Warhead

PHP seems to be compiled correctly:

```

narzul mysql # emerge -pv dev-lang/php

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ] dev-lang/php-5.1.6-r4  USE="apache2 cgi cli ctype fastbuild force-cgi-redirect ftp gd hash iconv ipv6 memlimit mysql nls pcre pdo pic posix reflection session simplexml soap sockets spl sqlite ssl tokenizer truetype xml xmlreader xmlwriter xsl zlib -adabas -apache -bcmath -berkdb -birdstep -bzip2 -calendar -cdb -cjk -concurrentmodphp -crypt -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif -fdftk -filepro -firebird -flatfile -frontbase -gd-external -gdbm -gmp -hardenedphp -hyperwave-api -imap -informix -inifile -interbase -iodbc -java-external -kerberos -ldap -libedit -mcve -mhash -ming -msql -mssql -mysqli -ncurses -oci8 -oci8-instant-client -odbc -pcntl -pdo-external -postgres -qdbm -readline -recode -sapdb -sasl -sharedext -sharedmem -snmp -solid -spell -sybase -sybase-ct -sysvipc -threads -tidy -unicode -vm-goto -vm-switch -wddx -xmlrpc -xpm -yaz -zip" 0 kB 

Total size of downloads: 0 kB

narzul mysql #

```

The directory /usr/share/webapps/mediawiki/1.6.8/conf is empty...I configured the Wiki via a webinterface, so I do not have the insight, where the software saves ist configuration. No documentation in /user/share/docs/mediawiki/INSTALL.txt ether. 

I guess etc-update killed somthing, but I did not changed any configuration, except /init.d scripts...

Regards

Warhead

----------

## cokey

try this: 

```
USE="mysqli" emerge php
```

try emerging php using the mysqli extention seeing as you are using >php5

----------

## Warhead

No effect in adding 'mysqli' to make.conf:

```

USE="aalib acpi adabas adns adsl afs apache2 async bash-completion bzip2 cairo

     caps cgi dba dbase dbx dedicated dio ethereal freetds gd gzip howl imagemagick 

     libcaca lm_sensors mime mmx msql mysql [b]mysqli[/b] nis nptl nptlonly offensive openssh

     pdf php postgres quotas samba sockets svg svga syslog tiff usb xml

     xmlreader zip -X -alsa -arts -avi -dri -eds -emboss -gnome -gtk -gtk2

     -ipv6 -kde -mpeg -opengl -oss -pdflib -pppd -qt -qt3 -qt4 -sdl -truetype

     -truetype-fonts -type1-fonts -xml2 -xmms -xorg -xv"

```

emerge stillt states:

```
narzul conf # emerge -pv dev-lang/php

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ] dev-lang/php-5.1.6-r4  USE="apache2 cgi cli ctype fastbuild force-cgi-redirect ftp gd hash iconv ipv6 memlimit mysql nls pcre pdo pic posix reflection session simplexml soap sockets spl sqlite ssl tokenizer truetype xml xmlreader xmlwriter xsl zlib -adabas -apache -bcmath -berkdb -birdstep -bzip2 -calendar -cdb -cjk -concurrentmodphp -crypt -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif -fdftk -filepro -firebird -flatfile -frontbase -gd-external -gdbm -gmp -hardenedphp -hyperwave-api -imap -informix -inifile -interbase -iodbc -java-external -kerberos -ldap -libedit -mcve -mhash -ming -msql -mssql -mysqli -ncurses -oci8 -oci8-instant-client -odbc -pcntl -pdo-external -postgres -qdbm -readline -recode -sapdb -sasl -sharedext -sharedmem -snmp -solid -spell -sybase -sybase-ct -sysvipc -threads -tidy -unicode -vm-goto -vm-switch -wddx -xmlrpc -xpm -yaz -zip" 0 kB 

Total size of downloads: 0 kB

narzul conf #

```

----------

## flash

Hi,

If you changed the mediawiki version. You must update the SQL tables. You go in your mediawiki directory and after you do:

".php maintenance/update.php"

and here you say what you see.

----------

