Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Posts
    77
    Rep Power
    14

    Question how can i find the PIDs in MySql


    Do I have to connect to mysql to find the process IDs (PIDs ) for this usr/local/mysql .. im trying to find parent mysql process and it children. i already know how to do it in ssh, but for some reason im stuck.... any suggestions...
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Location
    Germany
    Posts
    394
    Rep Power
    14
    I must admit that I was unable to completely understand the question, but maybe this will help...

    mysqld is often called with the "--pid-file=<filename>" option. You can read the process ID from this file.


    -Steven
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Posts
    77
    Rep Power
    14
    The process names for MySQL contain the word mysql located in
    /usr/local/mysql. but I need to know the process IDs (PIDs) associated with these
    processes and identify the parent mysql process and it children.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Location
    Germany
    Posts
    394
    Rep Power
    14
    I am unsure of what you mean with "located in". I at first assumed that you meant the /usr/local/mysql directory (which is not unix conform by the way), but that makes no sense to me.

    My next guess -- when you say located, are you referring to the output of the ps command? If you are, then the PID (Process ID) is usually in the second column. The first line of output of the ps command should be the column titles. To get the PPID, (Parent Process ID) use the -l switch.

    Code:
    ps -efl | grep PID
    
    #followed by:
    
    ps -efl | grep mysql
    -ef and -A are equivalent. (On BSD systems use -aux)

    example output on my BSD box:
    Code:
    /var/db/mysql # ps -Al | grep PID
    UID   PID  PPID CPU PRI NI   VSZ  RSS WCHAN  STAT  TT       TIME COMMAND
    /var/db/mysql # ps -Al | grep mysql
     0   158     1  24  10  0   652   260 wait   I+   con-   0:00,01 /bin/sh /usr/local/bin/mysqld_safe
    88   199   158   0   2  0 51332 18800 poll   S+   con-   1:23,54 /usr/local/libexec/mysqld
    in this simple example, the mysqld_safe is started by PID#1 and has PID#158. This in turn is the parent of mysqld which has PID#199.

    this is all well documented in the manpage so you can read it in:

    Code:
    man ps
    any help??

    -Steven


    ADDENDUM: You can, of course, us the -O or -o switches and tell ps which columns you want to see (and the order):

    Code:
    /var/db/mysql # ps -a -o ppid,pid,command | grep mysql
        1   158 /bin/sh /usr/local/bin/mysqld_safe 
      158   199 /usr/local/libexec/mysqld
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Location
    Germany
    Posts
    394
    Rep Power
    14
    btw, out of curiosity, what is your native language?

    -Steven
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Posts
    77
    Rep Power
    14
    I tried this but that what i get , im not sure if it's right. do I need to connect to mysql


    bash: /usr/local/mysql: is a directory
    bash-2.05$ ps -efl | grep PID
    F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
    8 S 3236 3005 0 50 20 ? 121 ? 23:51:44 pts/2 0:00 grep PID
    bash-2.05$ ps -efl | grep mysql
    8 S 3238 3005 0 50 20 ? 121 ? 23:52:07 pts/2 0:00 grep mysql


    /native language is arabic
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Location
    Germany
    Posts
    394
    Rep Power
    14
    ok. Well, ps is only showing you your own grep commands (because they contain the keywords):

    Code:
    F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
    8 S 3236 3005 0 50 20 ? 121 ? 23:51:44 pts/2 0:00 grep PID
    8 S 3238 3005 0 50 20 ? 121 ? 23:52:07 pts/2 0:00 grep mysql
    That is fine, but it is not showing the mysql daemon. Either mysqld is not running, or your version of ps requires that you use different switches, like -Al or -axl. Your manpages will explain the correct switches:

    man ps

    -Steven
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Posts
    77
    Rep Power
    14
    auctually i can't connect to mysql, every time i try i get this message, and i don't understand what it is:


    ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (146)
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Location
    Germany
    Posts
    394
    Rep Power
    14
    As I said, ps shows that mysql is not even running!!

    -Steven
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Posts
    77
    Rep Power
    14
    Originally Posted by stevengs
    As I said, ps shows that mysql is not even running!!

    -Steven

    how can i get it to run
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Location
    Germany
    Posts
    394
    Rep Power
    14
    well.., do you even know if it is installed? which operating system are you using? which version of mysql are you using?

    Code:
    uname -a
    path_to_mysqld/mysqld -V        #(if you don't know where to find mysqld try
                                    #    find / -name mysqld -print
    then look in your /etc/rc.d/ or /usr/local/etc/rc.d (or wherever your startup scripts are located, since I have no idea which unix youre using) and try to locate the startup script for the mysql-server.

    -Steven
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Posts
    77
    Rep Power
    14
    yes it's installed, its installed on a unix system that i have to connect to remotely. i have been connected to before but now everytime i enter my password i get the following message ::

    Enter password:
    ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (146)

    im not sure what this means
  24. #13
  25. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    103
    Rep Power
    14
    It means mySQL is not running like he said before.

    Try reading the documentation here: http://dev.mysql.com/doc/mysql/en/Automatic_start.html

    It will help you to get mySQL started so that you can connect to it again.

    *edit: You might need to edit your my.cf file and specify where the myslq.sock is located. You can also find out how to do that in the documentation.
  26. #14
  27. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Posts
    77
    Rep Power
    14
    Thanks for all your HELP guys, i still cant connect to mysql i should contact someone to get it running

    Thank You
  28. #15
  29. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Location
    Germany
    Posts
    394
    Rep Power
    14
    ...
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo