Bug #86844 mysql shell not in line with documentation
Submitted: 28 Jun 2017 6:32 Modified: 5 Dec 2017 11:44
Reporter: Bogdan Kecman Email Updates:
Status: Closed Impact on me:
None 
Category:Shell General / Core Client Severity:S3 (Non-critical)
Version:1.0.9 OS:Any
Assigned to: CPU Architecture:Any
Tags: shell

[28 Jun 2017 6:32] Bogdan Kecman
Description:
Hi,

According to https://downloads.mysql.com/docs/mysql-shell-excerpt-5.7-en.pdf

this should work but it does not:

mysql-js> \connect ssluser@127.0.0.1?sslCA=/root/clientcert/ca-cert.pem&sslCert=/root/clientcert/client-cert.pem&sslKey=/root/clientcert/client-key.pem
ERROR: Illegal character [/] found at position 24

Trying to enclose in ""  does not help

mysql-js> \connect ssluser@127.0.0.1?sslCA="/root/clientcert/ca-cert.pem"&sslCert="/root/clientcert/client-cert.pem"&sslKey="/root/clientcert/client-key.pem"
ERROR: Illegal character ["] found at position 24

Neither escaping them with \

Neither does using ssl-ca instead of sslCA etc.

How to repeat:
# /usr/local/mysql-shell-1.0.9-linux-glibc2.12-x86-64bit/bin/mysqlsh
Welcome to MySQL Shell 1.0.9

Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type '\help', '\h' or '\?' for help, type '\quit' or '\q' to exit.

Currently in JavaScript mode. Use \sql to switch to SQL mode and execute queries.
mysql-js> \connect ssluser@127.0.0.1?sslCA=/root/clientcert/ca-cert.pem&sslCert=/root/clientcert/client-cert.pem&sslKey=/root/clientcert/client-key.pem
ERROR: Illegal character [/] found at position 24
mysql-js> \connect ssluser@127.0.0.1?sslCA="/root/clientcert/ca-cert.pem"&sslCert="/root/clientcert/client-cert.pem"&sslKey="/root/clientcert/client-key.pem"
ERROR: Illegal character ["] found at position 24
mysql-js> \connect ssluser@127.0.0.1?sslCA=\/root\/clientcert\/ca-cert.pem&sslCert=\/root\/clientcert\/client-cert.pem&sslKey=\/root\/clientcert\/client-key.pem
ERROR: Illegal character [\] found at position 24
mysql-js> \connect ssluser@127.0.0.1?sslCA=ca-cert.pem&sslCert=client-cert.pem&sslKey=client-key.pem
Creating a Session to 'ssluser@127.0.0.1?sslCert=client-cert.pem&sslKey=client-key.pem'
Enter password:
ERROR: Unable to get certificate: client-cert.pem
mysql-js> \connect ssluser@127.0.0.1?sslCA=/root/clientcert/ca-cert.pem&sslCert=/root/clientcert/client-cert.pem&sslKey=/root/clientcert/client-key.pem
ERROR: Illegal character [/] found at position 24
mysql-js> \connect ssluser@127.0.0.1?ssl_ca=/root/clientcert/ca-cert.pem&sslCert=/root/clientcert/client-cert.pem&sslKey=/root/clientcert/client-key.pem
ERROR: Illegal character [/] found at position 25
mysql-js> \connect ssluser@127.0.0.1?ssl_ca=/root/clientcert/ca-cert.pem&sslCert=/root/clientcert/client-cert.pem&sslKey=/root/clientcert/client-key.pem
ERROR: Illegal character [/] found at position 25
mysql-js> \q

Suggested fix:
either change the manual and show proper way to write a full path to a cert or change the mysqlsh so it can read format written in the manual
[28 Jun 2017 6:42] MySQL Verification Team
workaround - you have to "urlencode" the string so this will work:

\connect ssluser@127.0.0.1?sslCA%3D%2Froot%2Fclientcert%2Fca-cert.pem%26sslCert%3D%2Froot%2Fclientcert%2Fclient-cert.pem%26sslKey%3D%2Froot%2Fclientcert%2Fclient-key.pem

but this is not how it is documented :(

all best
Bogdan
[5 Dec 2017 11:44] David Moss
Posted by developer:
 
Thanks for your feedback. Information about percent encoding or surrounding with parenthesis has been added to the docs. For example see:
https://dev.mysql.com/doc/refman/5.7/en/mysql-shell-connection-using-uri.html