The mysql client

mysql

How can we run SQL statements that are inside a text file?

  1. Connect to mysql as we normally do
  2. \. khaisql.txt

How can we tell the mysql client to ignore cache?

Try using the SQL_NO_CACHE (MySQL 5.7) option in your query:

SELECT SQL_NO_CACHE * FROM TABLE

Any reference to current date/time will disable the query cache for that selection:

SELECT *,NOW() FROM TABLE

How can we execute a SQL statement from the command line?

mysql -u user -p -e 'YOUR_SQL_STATEMENT' databaseName

How can we display the load on the server?

Connect to the MySQL server as we normally do with the mysql client, and then:

SHOW GLOBAL STATUS;

See also:

  1. http://jeremy.zawodny.com/mysql/mytop/ ( perfect for non-admin users )
  2. http://www.tecmint.com/mysql-performance-monitoring/
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License