Forums / Install & configuration / Error: eZMySQLDB Query error: Table doesn't exist.

Error: eZMySQLDB Query error: Table doesn't exist.

Author Message

Petter Neumann

Tuesday 25 August 2009 10:37:35 am

I get this error message in debug:

Error: eZMySQLDB Aug 25 2009 17:20:19

Query error: Table 'Databasename.ezsession' doesn't exist. Query: SELECT data, user_id, user_hash, expiration_time FROM ezsession WHERE session_key='8dbf043c5fba251098529bfb5bc70cf9'

When logging into mysql with the ezpublish user I'm able to see the table so the database user/passwd is correct.

My HD crashed but I was able to recover the files in /var/lib/mysql and /var/www

This seems to me like a permission problem, other sites using mysql from the same recovered disk works ok
I do :

root@server:~# cd /var/lib/mysql
root@server:/var/lib/mysql# ls -la
totalt 20564
drwxr-xr-x 8 mysql mysql 4096 2009-08-25 19:15 .
drwxr-xr-x 39 root root 4096 2009-08-25 13:54 ..
drwxr-xr-x 2 mysql mysql 12288 2009-07-31 18:00 dbblabla
-rw-r--r-- 1 mysql mysql 0 2009-07-31 18:13 debian-5.0.flag
-rw-rw---- 1 mysql mysql 10485760 2009-08-25 19:15 ibdata1
-rw-rw---- 1 mysql mysql 5242880 2009-08-25 19:15 ib_logfile0
-rw-rw---- 1 mysql mysql 5242880 2009-07-31 19:45 ib_logfile1
drwxr-xr-x 2 mysql mysql 4096 2009-07-31 18:26 mysql
-rw------- 1 mysql mysql 6 2009-07-31 19:45 mysql_upgrade_info
drwxr-xr-x 2 mysql mysql 4096 2009-07-31 18:25 db1
drwxrwxrwx 2 mysql mysql 4096 2009-07-31 18:25 db2 ---> this is the problem DB

Any help ?

Robin Muilwijk

Sunday 06 September 2009 3:03:36 am

Hi,

Is your problem solved already? And if not, what if you try a repair with phpMyAdmin on the sessions table?

Regards Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

André R.

Sunday 06 September 2009 7:49:32 am

If anyone else gets this problem, just run this(valid for 4.1.x and 4.2.x, remove user_hash line for 4.0.x) to restore the table*:

DROP TABLE IF EXISTS `ezsession`;
CREATE TABLE `ezsession` (
  `data` longtext NOT NULL,
  `expiration_time` int(11) NOT NULL default '0',
  `session_key` varchar(32) NOT NULL default '',
  `user_id` int(11) NOT NULL default '0',
  `user_hash` varchar(32) NOT NULL default '',
  PRIMARY KEY  (`session_key`),
  KEY `expiration_time` (`expiration_time`),
  KEY `ezsession_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

If your running something else then mysql, change last line to ");"!
* empty, but session data isn't something you need to keep anyway.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Robin Muilwijk

Sunday 06 September 2009 9:05:30 am

Hi André,

Just out of curiousity, what is the problem behind it, that running this script is required?

Thanks, Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

André R.

Monday 07 September 2009 1:02:16 am

His session table seems to be corrupted, so if it doesn't help to repair it, he can simply recreate it, thats all.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Robin Muilwijk

Monday 07 September 2009 11:34:24 am

Thanks for the answer André.

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Petter Neumann

Wednesday 09 September 2009 3:14:18 pm

Hi !

Recreation of the table removed that error, but it seems that I still got corrupted tables.

<i>Table 'databasename.ezuser' doesn't exist</i>

Is there any location in the instalation files I can find the <i>CREATE TABLE 'tablename' </i> definiton for other tables as shown in André R. ' s reply ??

What will the syntax be for recreating the 'ezuser' table ?? If recrating the 'ezusers' table, how to recreate the admin user from mysql ?? Ezpublish is version 4.13/ Mysql

/ Petter

André R.

Thursday 10 September 2009 12:44:40 am

You can't recreate other tables like this. Well you can, but you'll lose data and make the whole site unstable as other tables might contain data that depends on the table you recreate.
In the case of ezuser, it's the users of the system, without it, no one can login.

If you have to get data out of the database, you could try to rename the table, install a fresh eZ Publish install separately and copy the ezuser table over. Then anonymous (id=10) and admin (id=14) will normally work. But you'll probably just hit another table that is corrupted, and you will most likely not be able to do the same with that one.

This is the very reason why backups to external media are important.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom