Bug #18013 mysqlslap: errors after reading --create from file
Submitted: 7 Mar 2006 9:55 Modified: 5 Apr 2006 18:48
Reporter: Axel Schwenke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.1.8-beta OS:Linux (Linux)
Assigned to: Paul Dubois CPU Architecture:Any
Triage: D4 (Minor)

[7 Mar 2006 9:55] Axel Schwenke
Description:
After having read (and executed) --create from a file, mysqlslap complains about an empty query. Regardless if a query is given or not. The created schema is not deleted.

How to repeat:
~ $mysqladmin create test1
~ $mysql test1 -e "create table t1 (c1 int)"
~ $mysqldump test1 >test1.sql

~ $mysqlslap --delimiter=";" --create=test1.sql
mysqlslap: Cannot run query 
 ERROR : Query was empty

~ $mysqlslap --delimiter=";" --create=test1.sql --query="select * from t1"
mysqlslap: Cannot run query 
 ERROR : Query was empty

~ $echo "select * from t1" >test2.sql
~ $mysqlslap --delimiter=";" --create=test1.sql --query=test2.sql         
mysqlslap: Cannot run query 
 ERROR : Query was empty
[27 Mar 2006 13:36] Valeriy Kravchuk
Thank you for a problem report. Verified just as described on 5.1.8-BK (ChangeSet@1.2233, 2006-03-27 12:35:16+03:00).
[5 Apr 2006 18:48] Paul Dubois
Thank you for your bug report. This issue has been addressed in the
documentation. The updated documentation will appear on our website
shortly, and will be included in the next release of the relevant
product(s).
[13 Nov 2009 10:14] Dhruv Matani
A quick-fix for people in trouble like me.
Read the while file into a shell variable, and pass it quoted to --query as such:
Q=`cat file.sql`
mysqlslap --query="$Q"