LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to know if mysql is in use? (https://www.linuxquestions.org/questions/linux-server-73/how-to-know-if-mysql-is-in-use-659448/)

permalac 07-31-2008 04:02 AM

How to know if mysql is in use?
 
Hello,

i've lost the root mysql password and I want to recover it:

I know the steps :

/etc/init.d/mysql stop
mysqld_safe --skip-grant-tables &
mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
/etc/init.d/mysql stop



But i don't know if somebody is using the database, and on this case I have to wait.

How can I check if somebody is using the mysql database?



Thanks

datopdog 07-31-2008 05:23 AM

Code:

show processlist;

permalac 07-31-2008 05:54 AM

Quote:

Originally Posted by datopdog (Post 3231899)
Code:

show processlist;


Thanks,but I can not access the mysql database, I've lost the root password.

permalac 07-31-2008 10:22 AM

What i've done to check if somebody was using the mysql database is

$ps axu|grep mysql


But i'm quite sure that somewhere we can found somewhat better.


Cheers.

vladmihaisima 07-31-2008 10:54 AM

You could use netstat command to check what connections are active...

trickykid 07-31-2008 01:03 PM

Quote:

Originally Posted by vladmihaisima (Post 3232220)
You could use netstat command to check what connections are active...

Or you can reset your password to run the show processlist and quit trying to guess if it's in use or not.. ;)

Unfortunately in your case, someone who might be connected is just gonna have to suffer a little downtime so you can regain control of your database.

ps output isn't going to tell you squat if it's actually being used, only the pid of the mysql daemons listening for connections, etc.


All times are GMT -5. The time now is 11:44 PM.