Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The 'SLEEP' command in MySQL is throwing a syntax error:

mysql> sleep(5);

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sleep(5)' at line 1

This is on MySQL 5.6.23. I believe I have used SLEEP on the current version of MySQL on this server in the past, but I'm not sure what could have changed since then.

I've tried restarting the database server, but the problem persists. For what it's worth, the reason I want to use SLEEP is to determine the rate of Queries and Questions running on the server, ie

show global status like 'Qu%'; sleep(60); show global status like 'Qu%';
share|improve this question
up vote 2 down vote accepted

You have to use

select sleep(5);

because it is similar to other mysql functions.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.