MySQL High CPU Usage? Why?

Discussion in 'Apache' started by invisible121, Sep 23, 2008.

  1. #1
    I'm receiving this high cpu usage when checking it.

    It's the top process, %250+. What could cause it? I only have wordpress running on my VPS. Is it a sort of an attack? thanks
     
    invisible121, Sep 23, 2008 IP
  2. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #2
    1.
    make sure you have mysql password set - else you may eventually have OTHERS ( sites, hackers ) using YOUR mysql

    2.
    then - connected SSH to your server as root - do a

    mysqladmin -u root -pyourpasswordhere processlist

    to see how many processes are running
    or watch the processes using

    watch -n 5 mysqladmin -u root -pourpasswordhere proc
     
    hans, Sep 23, 2008 IP
  3. invisible121

    invisible121 Banned

    Messages:
    357
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I don't get it, I tried logging in SSH as root.. I typed

    # mysqladmin -u root -p processlist

    I pressed enter and it prompted for a password, i did input my root password but it gave me back this message:

    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost' (using password: YES)'


    what could go wrong? Thanks
     
    invisible121, Sep 23, 2008 IP
  4. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #4
    it is the MySQL password user root has FOR MySQL ..
    NOT necessarily the regular root password unless they are identical.

    if you are SSH connected, then I recommend my given syntax with password right after -p
    ( NO space between -p and password !! )
    there appears to be certain situations like my quoted watch syntax when the display hangs after prompting for mysql - password!

    a good idea would be to test the query on your local machine if you have same OS as your server - I do :) !!

    it also is an excellent idea to open remote a "screen"
    after login just type

    screen

    that assures that output is on that virtual console that can continue to run even if you get disconnected from your server

    later you re-attach to that screen using

    screen -r

    I usually open 2 SSH connections
    the second just in case in need to kill hanging "screen" :) or other processes if I do mistakes
     
    hans, Sep 23, 2008 IP