UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old July 26th, 2004, 05:21 PM
kwik222 kwik222 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 77 kwik222 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 22 m 39 sec
Reputation Power: 4
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...

Reply With Quote
  #2  
Old July 26th, 2004, 05:43 PM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 24 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
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

Reply With Quote
  #3  
Old July 26th, 2004, 08:13 PM
kwik222 kwik222 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 77 kwik222 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 22 m 39 sec
Reputation Power: 4
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.

Reply With Quote
  #4  
Old July 26th, 2004, 08:28 PM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 24 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
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

Reply With Quote
  #5  
Old July 26th, 2004, 09:32 PM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 24 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
btw, out of curiosity, what is your native language?

-Steven

Reply With Quote
  #6  
Old July 26th, 2004, 11:59 PM
kwik222 kwik222 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 77 kwik222 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 22 m 39 sec
Reputation Power: 4
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

Reply With Quote
  #7  
Old July 27th, 2004, 06:17 AM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 24 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
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

Reply With Quote
  #8  
Old July 27th, 2004, 07:51 AM
kwik222 kwik222 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 77 kwik222 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 22 m 39 sec
Reputation Power: 4
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)

Reply With Quote
  #9  
Old July 27th, 2004, 08:30 AM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 24 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
As I said, ps shows that mysql is not even running!!

-Steven

Reply With Quote
  #10  
Old July 27th, 2004, 05:31 PM
kwik222 kwik222 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 77 kwik222 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 22 m 39 sec
Reputation Power: 4
Quote:
Originally Posted by stevengs
As I said, ps shows that mysql is not even running!!

-Steven



how can i get it to run

Reply With Quote
  #11  
Old July 27th, 2004, 06:02 PM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 24 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
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

Reply With Quote
  #12  
Old July 27th, 2004, 08:08 PM
kwik222 kwik222 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 77 kwik222 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 22 m 39 sec
Reputation Power: 4
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

Reply With Quote
  #13  
Old July 28th, 2004, 09:04 AM
faulkner faulkner is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 103 faulkner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
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.

Reply With Quote
  #14  
Old July 28th, 2004, 10:25 PM
kwik222 kwik222 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 77 kwik222 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 22 m 39 sec
Reputation Power: 4
Thanks for all your HELP guys, i still cant connect to mysql i should contact someone to get it running

Thank You

Reply With Quote
  #15  
Old July 28th, 2004, 11:02 PM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 24 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
...

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > how can i find the PIDs in MySql


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump