mysql database...

I'm having some trouble accessing the mysql database. I get the following error message

SQL show index from `elggusers_sessions` failed : Table './elgg/elggusers_sessions' is marked as crashed and should be repaired

The trouble is I run a cron job every night to to optimize & autorepair the mysql database and the elggusers_sessions fails to show up amongst the elgg fields. Is this actually used in the current 1.5 version or is it just a ghost left over from a previous version?

  • Sql dump from distro says

    CREATE TABLE `prefix_users_sessions` (
    	`session` varchar(255) NOT NULL,
     	`ts` int(11) unsigned NOT NULL default '0',
    	`data` mediumblob,
    	PRIMARY KEY `session` (`session`),
    	KEY `ts` (`ts`)

    and this table can't be elggusers_sessions, I suppose (anyway, you can check you table's structure and compare), thus - I your table is a ancient piece

  • Thanks Alexander Thats what I figured..

    My problem now is, of course, I cannot access the database via webmin becuse whenever I try I get that stupid message up...

  • @Jed

    "elggusers_session" is correct naming for v1.5 if you installed with the dafault prefix of "elgg"

    have a look here for 'techie' notes which might help.

    Seems you will have to shut mysql down in order to attempt a repair


  • Dhrup, you made common mistake. Table prefix always separated from tablename by _ - see at CREATE template: `prefix_users_sessions`, so, with default prefix full tablename will be `elgg_users_sessions`, NOT elggusers_sessions

  • This is screen copy from my Elgg MyPhpAdmin

    So suppose then install of MySql has also "made common mistake..." ?

    LOL ;-0

    Browse Structure
    Search Insert
    Empty Drop
    0 B

    12.1 KiB
    940 B

    81.4 KiB
    49.1 KiB




  • Well I'm going to have to do something about this phantom entry because its also stopping me doimg backups of the elgg database.

    Any suggestions gratefully received..

  • Do you have shell access to the box?

    You must yo run myisamchk on corrupted index ("man myisamchk")

    Shell in needed for

    • starting myisamchk
    • detecting fulll patch to needed indexfile, because full command-line is

    myisamchk <path to databases dir>/<database>/<tablename>.MYI

    and probably -o or -r switch will be needed

  • Yes I ran it and it fixed my access to the database through webmin (I can see it all again)  but It still causes backups to fail with this error

    Database backup failed : mysqldump failed :

    mysqldump: Got error: 145: Table './elgg/elggusers_sessions' is marked as crashed and should be repaired when using LOCK TABLES

  • Okay further developments in case anyone is interested - after running

    myisamchk -r --force --safe-recover /var/lib/mysql/elgg/*.MYI

    a couple of times (recommended) and them trying to backup the database I get the following error...

    Database backup failed : mysqldump failed :

    mysqldump: Error 1194: Table 'elggusers_sessions' is marked as crashed and should be repaired when dumping table `elggusers_sessions` at row: 18

    So I ran it again and this time the error message was at row 25 after the attempted backup.. another try and its now up to row 30

    Something different eveytime so I'm just repeating the myisamchk until it runs out of lines to fix...

  • Oh god I'm back at the start again - I must have overdone the repairs...

    Just exactly what is that file for?