The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MySQL Logs question

Discussion in 'General Discussion' started by bsasninja, May 29, 2008.

  1. bsasninja

    bsasninja Well-Known Member

    Joined:
    Sep 2, 2004
    Messages:
    528
    Likes Received:
    0
    Trophy Points:
    16
    I would like to log the activity of an specific database on the server.

    Which lines should I add to my.cnf?

    Thank you!
     
  2. disappointed

    disappointed Active Member

    Joined:
    May 25, 2007
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Houston
    the problem with adding an entry to my.cnf specific to a a data base is if the data base is ever deleted, this can cause a problem

    You can look here for your errors just as well and you will see them here.

    /var/log/mysqld.log

    you can also use these to fine tune your my.cnf

    Type this on the command line then use one of the commands make sure to use the semi colon

    mysql

    show variables; <-- this will show what your settings are by default and you can up these settings in the my.cnf

    show status; <-- this will show what MYSQL is using in resources, and you can make further adjustments


    you can also do another thing, I would recomend you turn it of right after you find the problem though ti will eat disk space fast!

    first cp my.cnf my.cnf.sav <-- this is just in case you mess up some thing

    vi my.cnf or pico my.cnf

    In your my.cnf

    find a place like the end

    set-variable=long_query_time=1
    log-slow-queries=/var/log/mysql/log-slow-queries.log


    You must create the file manually and change owners this way:

    mkdir /var/log/mysql

    touch /var/log/mysql/log-slow-queries.log


    Then

    service mysql stop

    service mysql start

    if you did this correctly you will get a green ok back and your log will start filling up
     
    #2 disappointed, May 29, 2008
    Last edited: May 29, 2008
  3. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
    If you are running 11.23 you could might want to try out

    /usr/local/cpanel/bin/sqloptimizer
     
  4. disappointed

    disappointed Active Member

    Joined:
    May 25, 2007
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Houston
    Yeh you, might want to try what cpanel says, they know there os mods.

    Doing what I say might just put you in a real bind, after all I would not listen to some one who is black listed any way.

    Any of my ideas are not supported if they do not work then you will not get support, from any one.


    Last edited by disappointed; Today at 09:25 PM.

    oh and I just tested this on a freash server /usr/local/cpanel/bin/sqloptimizer what is it supose to do to my.cnf

    it came back and said

    root@serv1 [/etc]# /usr/local/cpanel/bin/sqloptimizer
    mysqld is not configured to log slow queries.
    root@serv1 [/etc]#

    With no changes to my.cnf to the server

    so I bet it wants this:

    set-variable=long_query_time=1
    log-slow-queries=/var/log/mysql/log-slow-queries.log

    mkdir /var/log/mysql

    touch /var/log/mysql/log-slow-queries.log

    And as I said before I would only enable this if your wantching this log file and then comant out the two entries and stop and restart mysql
     
    #4 disappointed, May 29, 2008
    Last edited: May 29, 2008
Loading...

Share This Page