1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.4 deleted table sessions

Discussion in 'Troubleshooting and Problems' started by surge, Nov 19, 2014.

  1. surge

    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?
  2. rainmotorsports

    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.
  3. Brogan

    Brogan XenForo Moderator Staff Member

    This is for 1.4.3:
    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`)
  4. surge

    surge Member

    oh thanks. I deleted the directory lol, but thanks for the help
  5. surge

    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
  6. rainmotorsports

    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.
  7. Jeremy

    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.

Share This Page