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

Unexpected Database Errors

Discussion in 'Troubleshooting and Problems' started by ting.mike, Dec 25, 2012.

  1. ting.mike

    ting.mike Member

    So after a few months of smooth sailing with XenForo, this few days I've seen the forum went down a few times with the error message "An unexpected database error occurred. Please try again later."

    I would reboot the server and it would go back up, only to have the same problem reoccurring after a few hours. Also during this period when the forum is online, sometimes trying to open certain threads return the same "An unexpected database error occurred. Please try again later."

    Any clue what to look for?

     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    View the source code of the error page. It should have a more detailed error message.
     
  3. ting.mike

    ting.mike Member

    Thanks Jake, I'm still having trouble logging in to the Admin CP (same error), but on console I did see this error message (near the bottom, something about the mysql partition being full):
    mysql-full.png
     
    Jake Bunce likes this.
  4. MattW

    MattW Well-Known Member

    That is telling you that the partition which is holding your MySQL install is full, hence MySQL isn't starting (why you can't access your ACP).

    When you log into the server, what is the output of
    Code:
    df -h
    ?
     
    ting.mike and Jake Bunce like this.
  5. ting.mike

    ting.mike Member



    Looks like I'm out of hard disk space?
     
  6. MattW

    MattW Well-Known Member

    Correct, your HDD is full.
     
    ting.mike and Jake Bunce like this.
  7. ting.mike

    ting.mike Member

    Thanks, Matt. So since I'm on a VPS, getting a larger HDD would solve the problem?
     
    MattW likes this.
  8. MattW

    MattW Well-Known Member

    Yes, you your host should be able to upgrade you (will usually require down time to reload the VPS to bring the new space allocation in), or you could have a look at what is using all the disc space and see if there is anything you can delete / recover.
     
    Jake Bunce likes this.
  9. ting.mike

    ting.mike Member

    Bigger space:

    Still the same database error :(
     
  10. ting.mike

    ting.mike Member

    Here is the error this time:

    mysql-fail.png

    That's weird because mysqld.pid apparently exists!

     
  11. MattW

    MattW Well-Known Member

    Try deleting the mysqld.pid file and restarting MySQL again
     
    Jake Bunce likes this.
  12. ting.mike

    ting.mike Member

    THanks, Matt.
    This is the error I got:



     
  13. MattW

    MattW Well-Known Member

    Do you have an error log configured? Should be something in your my.cnf file like so:

    log-error=/var/log/mysqld.error.log

    If you do, what is being written to the error log when trying to start MySQL?
     
    Jake Bunce likes this.
  14. ting.mike

    ting.mike Member

    Hi Matt,

    I have just tried enabling the error log using this guide (below). Afterwards, trying to restart mysql yield another failed. I opened the log on /var/log/mysql.log and found only a blank file. I also noticed that while monitoring the folder /var/run/mysqld/ folder, the file mysqld.pid file would come and go with no apparent reason.

    To debug applications which use a mysql database, it comes in handy to enable the query log to get all SQL queries that were sent to the database. Open the MySQL configuration file (my.cnf)
    vi /etc/mysql/my.cnf
    and add the line:
    log=/var/log/mysql.log
    in the [mysql] section of the file. Depending on the Linux distribution that you use, the my.cnf file can be /etc/my.cnf or /etc/mysql/my.cnf.
    Afterwards restart mysql to apply the new the configuration:
    /etc/init.d/mysql restart
     
  15. ting.mike

    ting.mike Member

    Just got this error message when I tried starting mysql again:

    root@www:/var/log# /etc/init.d/mysql start
    Starting MySQL database server: mysqld . . . . . . . . . . . . . ..
    Checking for corrupt, not cleanly closed and upgrade needing tables..
    root@www:/var/log# ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

    Still nothing on the mysql.log file
     
  16. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  17. ting.mike

    ting.mike Member

    Finally got some error logs on var/log/mysql/mysql.log:

    -edit-

    Tried to restarted it again and got the same error message (three times):

    /usr/sbin/mysqld, Version: 5.1.63-0+squeeze1-log ((Debian)). started with:
    Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
    Time Id Command Argument
    /usr/sbin/mysqld, Version: 5.1.63-0+squeeze1-log ((Debian)). started with:
    Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
    Time Id Command Argument
    /usr/sbin/mysqld, Version: 5.1.63-0+squeeze1-log ((Debian)). started with:
    Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
    Time Id Command Argument
     
  18. ting.mike

    ting.mike Member

  19. ting.mike

    ting.mike Member

    On /var/log/syslog:

     
  20. ting.mike

    ting.mike Member

    More errors upon calling the command mysqld:

     

Share This Page