Is there a Profiler equivalent for MySql?

"Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for monitoring an instance of the Database Engine or Analysis Services."

I find using SQL Server Profiler extremely useful during development, testing and when I am debugging database application problems. Does anybody know if there is an equivalent program for MySql?

82920 次浏览

I don't know about any profiling apps as such, but it's commonplace to use the EXPLAIN syntax for analysing queries. You can use these to figure out the best indexes to create, or you can try changing the overall query and see how it changes the efficiency, etc.

Something cool that is in version 5.0.37 of the community server is MySQL's new profiler.

This may give you what info you are looking for.

If version 5.0.37 isn't available, you might want to look at mytop. It simply outputs the current status of the server, but allows you to run EXPLAIN as (mentioned by mercutio) on particular queries.

Are you wanting to monitor performance, or just see which queries are executing? If the latter, you can configure MySQL to log all queries it's given. On a RedHat Linux box, you might add

log = /var/lib/mysql/query.log

to the [mysqld] section of /etc/my.cnf before restarting MySQL.

Remember that in a busy database scenario, those logs can grow quite large.

Jet Profiler is good if it's a paid version. The LogMonitor just point it to the mysql log file.

Try JET profiler is a real-time query performance and diagnostics tool! I use it in my work. Excellent software and support. Review Jet Profiler for MySQL

In my opinion I've found everything here in raw....

Find and open your MySQL configuration file, usually /etc/mysql/my.cnf on Ubuntu. Look for the section that says “Logging and Replication”

# * Logging and Replication
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.


log = /var/log/mysql/mysql.log

or in newer versions of mysql, comment OUT this lines of codes

general_log_file        = /var/log/mysql/mysql.log
general_log             = 1
log_error                = /var/log/mysql/error.log

Just uncomment the “log” variable to turn on logging. Restart MySQL with this command: sudo /etc/init.d/mysql restart

Now we’re ready to start monitoring the queries as they come in. Open up a new terminal and run this command to scroll the log file, adjusting the path if necessary.

tail -f /var/log/mysql/mysql.log

Not sure about graphical user interface but there is a command that has helped me profile stored procedures a lot in MySQL using workbench:

SET profiling = 1;
call your_procedure;
SHOW PROFILES;
SET profiling = 0;

Using Neor Profiler SQL, is excellent! and the application is free for all users. https://www.profilesql.com/download/ image of query flow