Mytop install for newbies

txt3rob

Verified User
Joined
Jan 16, 2007
Messages
101
Found this and it helped some problems i had :)

MySQL is one of the most important programs on a server, unfortunatly it is also pretty resource intensive. One a server it is not uncommon for a single user or even a query to take up the bulk of the servers cpu cycles. Mytop is a very useful program to see what queries a server is currently processing as well as which user is executing them. Think of mytop as top for mysql. If you see a lot from a user that means they are probably the hog. Mytop can also be useful for figuring out exactly which queries are causing the problem in the case of a self-designed website. The following is how to install mytop on the server and run it. Thanks to carlos for the actual commands


We are going to install 2 perl modules in addition to mytop to ensure that it will work.

Install TermReadKey:
Code:
cd /usr/local/src
wget http://search.cpan.org/CPAN/authors/id/J/JS/JSTOWE/TermReadKey-2.30.tar.gz
tar -zxf TermReadKey-2.30.tar.gz
cd TermRead*
perl Makefile.PL
make test
make
make install
cd ..

Now install DBI:
Code:
wget http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-1.48.tar.gz
tar -zxf DBI-1.48.tar.gz
cd DBI*
perl Makefile.PL
make test
make
make install
cd ..
Finally install mytop:
Code:
wget http://jeremy.zawodny.com/mysql/mytop/mytop-1.4.tar.gz
tar -zxf mytop-1.4.tar.gz
cd mytop*
perl Makefile.PL
make test
make
make install
Now simply run "mytop" and you're done!
 
FreeBSD users need only type the following (after ensuring your ports tree is up to date of course);
Code:
make install clean -C /usr/ports/databases/mytop

And whilst i'm at it Debian users probably need only type this;
Code:
apt-get install mytop

Installing applications via an OS's own package manager makes it easier to keep installed software up to date in the future.
 
Last edited:
FreeBSD users need only type the following (after ensuring your ports tree is up to date of course);
Code:
make install clean -C /usr/ports/databases/mytop

And whilst i'm at it Debian users probably need only type this;
Code:
apt-get install mytop

Installing applications via an OS's own package manager makes it easier to keep installed software up to date in the future.

Wow tell me more mr science!
 
Wow tell me more mr science!
Not quite sure what you meant by this but, as i'm sure your aware, nobody here gets paid for giving information it's just a case of donating time and common courteousness.
Thanks for your input though
 
I installed mytop and other perl modules. after install with on error I've got below message after run "mytop"

Error in option spec: "long|!"
 

Thank you. but after fixed above problem and run "mytop" again. I've got below message.

Cannot connect to MySQL server. Please check the:

* database you specified "test" (default is "test")
* username you specified "root" (default is "root")
* password you specified "" (default is "")
* hostname you specified "localhost" (default is "localhost")
* port you specified "3306" (default is 3306)
* socket you specified "" (default is "")

The options my be specified on the command-line or in a ~/.mytop
config file. See the manual (perldoc mytop) for details.

Here's the exact error from DBI. It might help you debug:

Access denied for user 'root'@'localhost' (using password: NO)
 
mytop needs soma parameters to run.
so you have to add your database name ,user and pass
eg
mytop -d test_db -u test_user -p your_pass
 
mytop needs soma parameters to run.
so you have to add your database name ,user and pass
eg
mytop -d test_db -u test_user -p your_pass

Thank you it work. but before I install mytop I think it's a tool to monitor All databases and show which user which database use too much resource.

It's my misunderstood :confused:
 
Back
Top