Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2006
    Posts
    5

    Unanswered: Query - When MySQL server/databas has been started

    I'm trying to find out when MySQL DATABASE/SERVER started and how long it has been running. Is there query or command in that I can use to check this? Is there more than one option to find this out and is it same for all MySQL versions or diffferent from version to version?

    Thanks

  2. #2
    Join Date
    Mar 2004
    Posts
    480
    from the mysql prompt:

    Code:
    \s

  3. #3
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    If your server is running on Linux you can also use OS commands to determine the start date of the process. For instance:

    Code:
    ps -fu mysql
    This will return the process information including the process ID and start time.

    Code:
    # ps -fu mysql
    UID        PID  PPID  C STIME TTY          TIME CMD
    mysql     3436  3385  0 Sep06 ?        00:02:22 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/mysqld.pid --skip-external-locking --port=3306 --socket=/var/lib/
    If the start time (STIME) is not sufficient in this case you can have a look at the process directory (using root):

    Code:
    ls -lad /proc/3436
    dr-xr-xr-x 6 mysql mysql 0 Sep  6 21:45 /proc/3436
    This directory is created when the process gets created and one exists for each process running on the server.
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •