Bug #27298 --execute fails with single quotes
Submitted: 20 Mar 2007 17:43 Modified: 20 Mar 2007 18:00
Reporter: Scott Noyes (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0.33 OS:Windows (Windows XP)
Assigned to: Paul DuBois CPU Architecture:Any
Tags: qc

[20 Mar 2007 17:43] Scott Noyes
Description:
http://dev.mysql.com/doc/refman/5.0/en/command-line-options.html says, "Another option that may occasionally be useful with mysql is the --execute or -e option, which can be used to pass SQL statements to the server. The statements must be enclosed by single or double quotation marks."

Using single quotes for the execute string on Windows XP fails. Double quotes succeed.

How to repeat:
C:\>mysql -e 'help show'
ERROR 1049 (42000): Unknown database 'show''

C:\>mysql -e "help show"
Name: 'SHOW'
Description:
SHOW has many forms that provide information about databases, tables,
columns, or status information about the server. This section describes
those following:
...

Suggested fix:
Fix the parser to allow single quotes, unless that's a Windows thing rather than a MySQL thing, in which case change the manual.
[20 Mar 2007 17:48] Sveta Smirnova
Thank you for the report.

Verified as described.
[20 Mar 2007 17:50] Paul DuBois
The quotes that you use will be dictated by the capabilities
of your command processor. I'll note that in the section.
[20 Mar 2007 18:00] 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 products.
[20 Mar 2007 20:20] Giuseppe Maxia
It depends on the shell. The Windows command processor does not honor single quotes.

Consider this test.bat

@echo off
echo param 1: %1
echo param 2: %2

C:>test.bat 'one two'
param 1: 'one
param 2: two'

C:>test.bat "one two"
param 1: "one two"
param 2:

Only words within double quotes will be grouped together to form a single parameter.