[Mediawiki-l] hard disk crash: try to recover the wiki. (Mediawiki 1.9.3 mysql)

2 views
Skip to first unread message

Uwe Brauer

unread,
Sep 13, 2010, 1:49:03 PM9/13/10
to media...@lists.wikimedia.org


Hello

This is a real nightmare. A Mac crashed, the hard disk could
be saved. Right now it can't be booted. That hard disk contained
the wiki of our department.

I don't know precisely the version of the OS (most likely Mac X
10.4), nor the version of mysql (most likely 5.3.x) and to make
things worse I did not generate a dump of the mysql data base.
I have however "access" to the database in the sense that I have
a copy of the files /var/lib/mysql/maqwiki
(maqwiki is the name of the database)

I followed the advice offered in the mysql mailing list
namely

[+]
> service mysql stop
> cd /var/lib/mysql
> rm -rf *
> tar zxvf maqwiki.tar
> rm -rf ib_logfile*
> chown -R mysql.mysql
> service mysql start

However after having installed the mediawiki software (I
stick for the moment to 1.9.3) and trying to connect to the
database I only see empty pages.

- Could it be that the database was damaged when the hard
disk crashed?
As a matter of fact when I have a look into the
/var/lib/mysql/maqwiki
directory most of the files are very small in size with the
exception of searchindex.MYD and searchindex.MYI. I
have no idea whether this is "normal".

- I did not do the recover process correctly. Is there
any "hardcore" mysql command I could use to check the
database?

- the connection between the mediawiki conf and the
data base is broken. How can I check?


Any help is very much appreciated.

Uwe Brauer

_______________________________________________
MediaWiki-l mailing list
Media...@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

George Herbert

unread,
Sep 13, 2010, 1:55:30 PM9/13/10
to Uwe Brauer, MediaWiki announcements and site admin list

Yes, but ideally you should find someone who already knows SQL and
MySQL a bit to help with this...

The files being small is not necessarily disaster. If you Wiki was
small the table files will be small.

Look at the Mediawiki logfiles, see if they're indicating any database
problems. If they are...

Log in to the database with the mysql command line command and run the
command "show tables;"

Compare that list with the tables in the Mediawiki software
documentation page. See if anything is missing.

Then you can review the table contents with "select * from {tablename};"

--
-george william herbert
george....@gmail.com

Uwe Brauer

unread,
Sep 13, 2010, 4:35:07 PM9/13/10
to George Herbert, MediaWiki announcements and site admin list

> The files being small is not necessarily disaster. If you Wiki was
> small the table files will be small.

Well I run strings and grep over these files but the only
files with useful information are searchindex.MYD and searchindey.MYI


> Look at the Mediawiki logfiles, see if they're
> indicating any database problems. If they are...

> Log in to the database with the mysql command line command and run the
> command "show tables;"

Well here I have a problem. Say the password is password
then the command
mysql -u wikiuser -p=password maqwiki
gives me
ERROR 1045 (28000): Access denied for user 'wikiuser'@'localhost' (using password: YES)

And I checked with

sudo mysql_setpermission
the permission of that database.


Uwe Brauer

Platonides

unread,
Sep 13, 2010, 6:38:17 PM9/13/10
to media...@lists.wikimedia.org
Uwe Brauer wrote:

> most of the files are very small in size with the
>exception of searchindex.MYD and searchindex.MYI. I
>have no idea whether this is "normal".

> Well I run strings and grep over these files but the only


> files with useful information are searchindex.MYD and searchindey.MYI
>

Your tables will be in InnoDB, with the table files just holding
pointers to ibdata1 file. searchindex table is in MyIsam and thus the
content is really on those files.


> > Look at the Mediawiki logfiles, see if they're
> > indicating any database problems. If they are...
>
> > Log in to the database with the mysql command line command and run the
> > command "show tables;"
>
> Well here I have a problem. Say the password is password
> then the command
> mysql -u wikiuser -p=password maqwiki
> gives me
> ERROR 1045 (28000): Access denied for user 'wikiuser'@'localhost' (using password: YES)

The command should be mysql -u wikiuser -ppassword maqwiki
(ie. no = sign)


> I did not do the recover process correctly. Is there
> any "hardcore" mysql command I could use to check the
> database?

Try to mysqldump it and look for errors in mysql log file.

Uwe Brauer

unread,
Sep 14, 2010, 5:04:59 PM9/14/10
to media...@lists.wikimedia.org
>>>>> On Tue, 14 Sep 2010 00:38:17 +0200, Platonides
>>>>> <Plato...@gmail.com> wrote:

> Uwe Brauer wrote:
>> most of the files are very small in size with the
>> exception of searchindex.MYD and searchindex.MYI. I
>> have no idea whether this is "normal".

>> Well I run strings and grep over these files but the
>> only files with useful information are searchindex.MYD
>> and searchindey.MYI
>>

> Your tables will be in InnoDB, with the table files
> just holding pointers to ibdata1 file. searchindex
> table is in MyIsam and thus the content is really on
> those files.

To be honstest I don't understand completely what you ay,
since I don't know exactly what InnoDB is although I have
heard the word.

I just found a mysql dump file from another wiki.
I could succesfully use that dump and later conncect
wikimedia to that db. There is however a difference this db
has more .MYD and MYI files for example
wp_users.MYD
wp_users.MYI

Etc.

Does this mean that the database from the crashed hard disk
is may be corrupt, since it has only 1 MYD and 1 MYI
file????


Is there any way to extract the ASCII text (anything more
sophisticated than "strings") from
searchindex.MYD and searchindey.MYI

>> > Look at the Mediawiki logfiles, see if they're
>> > indicating any database problems. If they are...
>>
>> > Log in to the database with the mysql command line
>> > command and run the command "show tables;"

sorry my ignorance

You mean
> mysql -p wikidb
mysql > show tables

Well it does not return anything also mediawiki connects
correctly to that database.

I am puzzled

George Herbert

unread,
Sep 14, 2010, 5:20:39 PM9/14/10
to Uwe Brauer, MediaWiki announcements and site admin list

The "show tables;" command within MySQL has to have the semicolon at
the end, or it doesn't work.

What are you seeing in the logs that convinces you the connection from
MediaWiki is working properly?


--
-george william herbert
george....@gmail.com

_______________________________________________

Nyamul Hassan

unread,
Sep 14, 2010, 5:56:05 PM9/14/10
to MediaWiki
First you need to recover the database, and see if all is in order, before
you can be certain of no data loss. To do that, don't only copy the
"maqwiki" folder, but I would recommend the whole "/var/lib/mysql" (if that
is your mysql data folder).

Once you copy that folder to a different machine, I would then recommend,
you copy it to a different path, say "/bak/oldmysql". Then, install a new
MySQL in that computer, and check to make sure that everything is working
with MySQL (like a basic "select 1", "show databases" etc.).

Then, install "Media Wiki 1.93" (make sure it is the same version that you
originally had installed) on this computer, and it is better if you can use
the same name as you used in your older installation, like "maqwiki".

After installing MediaWiki, check out the number of files under
"/var/lib/mysql/<db>" (where <db> is to be replaced with the new db-name
that you used in the last step. Once inside the folder, you can check if
the name / number of files match you backed up folder.

Now, I would suggest that you stop MySQL and edit the MySQL config file
(usually /etc/my.cnf) and change the "datadir" value to the backed up folder
(like "/bak/oldmysql" if you followed my email to the letter). Now, start
MySQL. If MySQL comes up cleanly, then you need to run the mysql cli, and
check out if you can do basic "select 1" and "show databases" etc.

If you're through with all the above, then you need to change MediaWiki
should work just fine when you open it in the browser.

Good luck on getting your data back.

Regards
HASSAN

Uwe Brauer

unread,
Sep 15, 2010, 9:47:40 AM9/15/10
to media...@lists.wikimedia.org
>>>>> On Wed, 15 Sep 2010 03:56:05 +0600, Nyamul Hassan <mnha...@usa.net> wrote:

[snip]


> Good luck on getting your data back.

> Regards
> HASSAN

Thanks for your detailed instructions I will try.

Uwe

Uwe Brauer

unread,
Sep 15, 2010, 9:49:11 AM9/15/10
to media...@lists.wikimedia.org
[snip]

> The "show tables;" command within MySQL has to have the
> semicolon at the end, or it doesn't work.

Ok, this works and shows a list of tables. BTW how can I see
the content of these tables?

> What are you seeing in the logs that convinces you the
> connection from MediaWiki is working properly?

Well which logs, uh in the directory where the mediawiki
software is installed there aren't any. Or do you mean
ib_logfile0 in the mysql directory, that file is huge!


Uwe Brauer

Uwe Brauer

unread,
Sep 16, 2010, 8:47:38 AM9/16/10
to media...@lists.wikimedia.org
>>>>> On Wed, 15 Sep 2010 03:56:05 +0600, Nyamul Hassan <mnha...@usa.net> wrote:

> First you need to recover the database, and see if all is in order, before
> you can be certain of no data loss. To do that, don't only copy the
> "maqwiki" folder, but I would recommend the whole "/var/lib/mysql" (if that
> is your mysql data folder).

Your trick did not work, since I could not restart the mysql
server after having copied the entire directory but when I
copied the dir /var/lib/mysql/maqwiki *and* the ibfile1
_then_ I can connect to the db!!!!


Thanks

Uwe Brauer

Huib Laurens

unread,
Sep 16, 2010, 8:49:57 AM9/16/10
to Uwe Brauer, MediaWiki announcements and site admin list
please, please, please dont create three new topics to say its fixed.

But I'm happy to hear its fixed


--
Regards,
Huib "Abigor" Laurens

Support Free Knowledge: http://wikimediafoundation.org/wiki/Donate

Nyamul Hassan

unread,
Sep 17, 2010, 8:47:59 AM9/17/10
to MediaWiki announcements and site admin list
You did not follow my instruction properly. I asked you to copy the full
"/var/lib/mysql" directory, not just the "maqwiki" folder. If you had
copied the entire "/var/lib/mysql", then the ib* files would've bene copied
as well, which were what you needed, as is apparent from your other post.

Anyway, it's good that you got it fixed.

Regards
HASSAN

Uwe Brauer

unread,
Sep 17, 2010, 9:00:31 AM9/17/10
to media...@lists.wikimedia.org
>>>>> On Fri, 17 Sep 2010 18:47:59 +0600, Nyamul Hassan <mnha...@usa.net> wrote:

> You did not follow my instruction properly. I asked you to copy the full
> "/var/lib/mysql" directory, not just the "maqwiki" folder. If you had
> copied the entire "/var/lib/mysql", then the ib* files would've bene copied
> as well, which were what you needed, as is apparent from your other post.

It seems that my other answer to your instructions did not
get trough. I did *follow* your instructions but then the
mysqlserver did not start up!
When I copied the directory maqwiki and the ib* files then
the server came up!

Nyamul Hassan

unread,
Sep 17, 2010, 10:08:43 AM9/17/10
to Uwe Brauer, MediaWiki announcements and site admin list
Aren't both the maqwiki folder and the ib* files in "/var/lib/mysql"?

Regards
HASSAN

--
Sent from my mobile device

Reply all
Reply to author
Forward
0 new messages