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

XF 1.3 Accidentally removed MySQL and website down.

Discussion in 'XenForo Questions and Support' started by Silverbrit, Apr 17, 2014.

  1. Silverbrit

    Silverbrit Member

    I'm not sure why, but I removed MySQL from my server last night. When I go to my website now I get the error 'An unexpected database error occurred. Please try again later.'.

    I then reinstalled mysql and mysqli and reenabled it in the php.ini and I passed the xenfororequirements.php script.

    However I still cannot access my website and when I go to www.[forums].com/install I get this error:

    Server Error
    Mysqli prepare error: Table 'SilverXF.xf_session_admin' doesn't exist
    Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
    Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
    Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
    Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 825
    Zend_Db_Adapter_Abstract->fetchOne() in XenForo/Session.php at line 719
    XenForo_Session->getSessionFromSource() in XenForo/Session.php at line 429
    XenForo_Session->_setup() in XenForo/Session.php at line 413
    XenForo_Session->start() in XenForo/Install/Controller/Upgrade.php at line 48
    XenForo_Install_Controller_Upgrade->_setupSession() in XenForo/Controller.php at line 304
    XenForo_Controller->preDispatch() in XenForo/FrontController.php at line 346
    XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
    XenForo_FrontController->run() in /var/www/install/index.php at line 18
    I'm really inexperienced with MySQL and I only removed MySQL because I was logged into the wrong server.

    Is there anyway I can fix this, and I would like to know if I lost any data?

  2. Martok

    Martok Well-Known Member

    That sounds like the xf_session_admin table is missing.

    Can you restore your database from a recent backup?
  3. borbole

    borbole Well-Known Member

    When you say you removed MySQL, what does that mean exactly? Did you remove the db that your forum resides on? If that is the case then yes, you lost all the data and you should restore your most recent backup as mentioned above.
    HWS likes this.
  4. Slavik

    Slavik XenForo Moderator Staff Member

    More specifically, how did you remove mysql...
  5. Silverbrit

    Silverbrit Member

    I deleted the xenforo database using drop database. I also don't have any Backups, so I've pretty much have to recreate my website.

    Did I lose things like the styles or can I recover that.
  6. borbole

    borbole Well-Known Member

    I am afraid that you lost everything in that case.

    P.s. Can you ask your host in the off-chance that they have made a backup. A this point I think you have nothing to loose and everything to gain.
  7. Silverbrit

    Silverbrit Member

    Looks like I'm out of luck. Didn't realize how much is actually stored on the database.

    Suppose its a learning experience and a reminder to make backups
  8. Tracy Perry

    Tracy Perry Well-Known Member

    Ehhh.. ayep.
    Just about everything (except for your physical files you upload) pertaining toe the forum structure, add-on configs and forum configs are contained therein.
    Hopefully you didn't have a lot of posts... but you will have to invest the time again to recreate your forum structure and styling.
    Let me make a suggestion - make an initial backup right after install and basic configuration.
    Then install any add-ons, set up your node structure and your style and then run another DB backup.
    In addition at that time you should back up the forum structure itself (recursively) and place those in a safe place (depending on how large it is a DVD or two would probably do) in addition to keeping then on your computer hard drive.
    That way it gives you a base install (a lot faster than re-installing and then one with your structure intact.
    After that you need to take regular backups.
  9. Silverbrit

    Silverbrit Member

    Thanks for the reply, thankfully we didn't have many posts but we had 120 members. What method should I go about creating backups, what do you suggest?

    I'm already close to having the website setup like how it was before.
  10. MattW

    MattW Well-Known Member

    Depends on your budget, and what your current skill set is. Ideally, you want them offsite, and as frequent as possible, both database and forum files.
    Tracy Perry likes this.
  11. Silverbrit

    Silverbrit Member

    Hi, I am now receiving this error after I restarted my digitalocean server and enabled backups, I made a snapshot before and used that to make a new droplet and now I get this error

    Server Error
    Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    Zend_Db_Adapter_Mysqli->_connect() in Zend/Db/Adapter/Abstract.php at line 315
    Zend_Db_Adapter_Abstract->getConnection() in XenForo/Application.php at line 685
    call_user_func_array() in XenForo/Application.php at line 922
    XenForo_Application->lazyLoad() in XenForo/Application.php at line 953
    XenForo_Application::get() in XenForo/Application.php at line 1481
    XenForo_Application::getDb() in XenForo/Session.php at line 236
    XenForo_Session->__construct() in XenForo/Install/Controller/Upgrade.php at line 46
    XenForo_Install_Controller_Upgrade->_setupSession() in XenForo/Controller.php at line 304
    XenForo_Controller->preDispatch() in XenForo/FrontController.php at line 346
    XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
    XenForo_FrontController->run() in /var/www/install/index.php at line 18
    Any idea, thanks?
  12. Tracy Perry

    Tracy Perry Well-Known Member

    What OS? How did you install mysql? What http server? Is the server (mysql) started?
  13. Silverbrit

    Silverbrit Member

    Ubuntu 12.04 LTS, MySQL was working perfectly before I made the snapshot. Was told by digital ocean support this

    There has been a response to your ticket:
    At the moment, you can only enable backups when creating a new server.
    To enable automatic backups on an existing server, you'll need to follow these instructions:
    1) create a snapshot of your server
    2) delete your server to release the IP
    3) immediately after the delete is finished, create a new droplet, choose the same datacenter, and in the "select images" section switch to "my images" and select your snapshot. Then check the "Enable Backups" box.
    This server will almost always capture the IP just released.
    DigitalOcean Support
    So I did just that so I could have backups now I'm getting this database error.
  14. Tracy Perry

    Tracy Perry Well-Known Member

    Not familiar with DO's snapshots. If it's anything like ProxMox uses, it's a copy of the existing VPS (with all config settings - but I use static IP's assigned to the VPS's). The backups I was referring to is simply using mysqldump to dump the DB, archive it and then transfer it.
    If you have the DB and you want, I can probably get you set up (Ubuntu is almost identical to Debian with just a few added quirks). If you want, start a conversation with me and we'll set up login creds.
  15. Silverbrit

    Silverbrit Member

    Will you fix the issue? and I won't he able to do it tonight
  16. Tracy Perry

    Tracy Perry Well-Known Member

    If you have a base droplet installed and the DB uploaded to a directory that I can access (and you have your forum installed with the web server up and running) I should be able to get mysql up and running fine.
  17. Silverbrit

    Silverbrit Member

    Will you be able to help me out at around 3pm EST?
  18. Tracy Perry

    Tracy Perry Well-Known Member

    I've been up all night installing 2 Ubuntu 14.04 test bed VPS's, 1 Gentoo (still working on it) and 1 BSD and am about to head off for a nap.
    That will be about 2PM Central so I probably won't be back up by then. I'm going to try and grab at least 8 hours of sleep (been up for 37 as of now).
    Send me a conversation with login information and place your DB in a directory you tell me about and also upload your forum structure somewhere I can get to.

Share This Page