XF 1.4 deleted table sessions

surge

Member
Hey, I have a large forums on a small dedicated machine and there is usually like a hundred people on. What happens is, the xf_session table messed up and makes the website crash. Usually to fix this, I empty the table whenever the website goes offline. This time instead of emptying the table, i accidently deleted the table in myphpadmin. Now the website says An unexpected error occurred. Please try again later.
I can make a new table but I don't know what the columns. Does anyone know how I can create a blank xf_session table?
 

rainmotorsports

Well-known member
If you look through the install code you will actually find the SQL for the create. Ought to be in the install directory just search by the table name until u see the create or create if not exists.

Someone will drop it to you. Probably would have been best to create a ticket. I'd find it but I'm not at a PC. Figured I'd tell u where to look though.
 

Brogan

XenForo moderator
Staff member
This is for 1.4.3:
Code:
CREATE TABLE `xf_session` (
`session_id` varbinary(32) NOT NULL,
`session_data` mediumblob NOT NULL,
`expiry_date` int(10) unsigned NOT NULL,
PRIMARY KEY (`session_id`),
KEY `expiry_date` (`expiry_date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
 

surge

Member
lol you beat me

$tables['xf_session'] = "
CREATE TABLE xf_session (
session_id VARBINARY(32) NOT NULL,
session_data MEDIUMBLOB NOT NULL,
expiry_date INT UNSIGNED NOT NULL,
PRIMARY KEY (session_id),
KEY expiry_date (expiry_date)
) ENGINE = MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci
";
 

rainmotorsports

Well-known member
Yeah. But as brogan pasted it. U need to cut the php out around it. Everything between the quotes. In case you ever delete another innocent table by accident.
 

Jeremy

Well-known member
If your websites session table fails daily, it may be time to research mysql optimizations or contact your host -- it shouldn't fail, but definitely not fail that often.
 
Top