Bug #81051 error connecting to server
Submitted: 12 Apr 2016 12:14 Modified: 28 Jul 2016 6:16
Reporter: Colin Charles Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Document Store: MySQL Shell Severity:S3 (Non-critical)
Version:1.0.3, 1.0.4 OS:CentOS (7)
Assigned to: CPU Architecture:Any

[12 Apr 2016 12:14] Colin Charles
Description:
On a fresh MySQL 5.7 install via the yum repository provided by MySQL, on a fresh CentOS 7 server, MySQL installs and you can connect to it but mysqlsh throws errors.

How to repeat:
1. install mysql57-community-release-el7-8.noarch.rpm
2. install mysql server
3. enable the mysql-tools-preview repository
4. install mysql-shell (mysql-shell-1.0.3-1.el7.x86_64)
5. Try connecting to the server regularly (it works)
[root@mysql57 ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.12 MySQL Community Server (GPL)
6. Try using mysqlsh and see that it fails

Via the docs: http://dev.mysql.com/doc/refman/5.7/en/mysql-shell-create-session-using-shell.html

mysql-js> \connect root:@localhost
Creating an X Session to root@localhost:33060
MySQL Error (2002): Connection refused connecting to localhost:33060

mysql-js> \connect root:@localhost:3306
Creating an X Session to root@localhost:3306
MySQL Error (2027): Unknown message received from server 10

Suggested fix:
Allow connections to work via mysqlsh
[12 Apr 2016 12:20] Colin Charles
This is largely because the X Plugin needs to be installed manually. 

mysql-js> \connect root:@localhost
Creating an X Session to root@localhost:33060
MySQL Error (1045): Invalid user or password

So is the only way to enter the password above?

mysql-js> \connect root:abc123@localhost
Creating an X Session to root@localhost:33060
No default schema selected.

The above does work. But the password is entered normally as opposed to there being some kind of challenge. 

So maybe the documentation needs to be clearer about this around http://dev.mysql.com/doc/refman/5.7/en/mysql-shell.html ?

Thanks
[21 Apr 2016 11:10] MySQL Verification Team
Hello Colin,

Thank you for the report and feedback.
I see you have already figured out the reason for the issue i.e. you have to install X Plugin to enable MySQL Server to use the X Protocol. 

-- on my local instance

[root@cluster-repo ~]# mysqlsh -u root -h localhost -p --classic --dba enableXProtocol
Creating a Classic Session to root@localhost:3306
Enter password:
No default schema selected.

enableXProtocol: Installing plugin mysqlx...
enableXProtocol: done

[root@cluster-repo ~]#  mysqlsh --uri root@localhost
Creating an X Session to root@localhost:33060
Enter password:
No default schema selected.

Welcome to MySQL Shell 1.0.3 Development Preview

Copyright (c) 2016, 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.

Currently in JavaScript mode. Use \sql to switch to SQL mode and execute queries.
mysql-js>

-- mysql session

mysql> UNINSTALL PLUGIN mysqlx;
Query OK, 0 rows affected (0.18 sec)

-- try to connect using mysqlsh

[root@cluster-repo ~]# mysqlsh --uri root@localhost
Creating an X Session to root@localhost:33060
Enter password:
MySQL Error (2002): Connection refused connecting to localhost:33060
[root@cluster-repo ~]#

-- mysql session - install plugin

mysql> INSTALL PLUGIN mysqlx SONAME 'mysqlx.so';
Query OK, 0 rows affected (0.00 sec)

mysql> show plugins;
+----------------------------+----------+--------------------+-----------------+---------+
| Name                       | Status   | Type               | Library         | License |
+----------------------------+----------+--------------------+-----------------+---------+
.

| mysqlx                     | ACTIVE   | DAEMON             | mysqlx.so       | GPL     |
+----------------------------+----------+--------------------+-----------------+---------+
46 rows in set (0.00 sec)

-- try to connect using mysqlsh

[root@cluster-repo ~]# mysqlsh --uri root@localhost
Creating an X Session to root@localhost:33060
Enter password:
No default schema selected.

Welcome to MySQL Shell 1.0.3 Development Preview

Copyright (c) 2016, 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.

Currently in JavaScript mode. Use \sql to switch to SQL mode and execute queries.
mysql-js>

-- if no password is specified using the URI, then the password is prompted

[root@cluster-repo ~]# mysqlsh --uri root@localhost
Creating an X Session to root@localhost:33060
Enter password:
No default schema selected.

Welcome to MySQL Shell 1.0.3 Development Preview

Copyright (c) 2016, 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.

Currently in JavaScript mode. Use \sql to switch to SQL mode and execute queries.
mysql-js>
mysql-js> \connect root@localhost
Creating an X Session to root@localhost:33060
Enter password:
No default schema selected.

mysql-js>

Imho, connection specific details are documented here https://dev.mysql.com/doc/refman/5.7/en/mysql-shell-connections.html
Please let us know if you think anything is missing here.

Thanks,
Umesh
[22 May 2016 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[12 Jul 2016 7:36] Shahriyar Rzayev
I am getting same error while providing different --port:

mysqlsh --sql -uroot --socket=/home/sh/Percona-XtraDB-Cluster-5.7.12-rel5beta-26.16.1.Linux.x86_64/node3/socket.sock --port=15200
Creating a Node Session to root@localhost:15200
Enter password:
MySQL Error (2027): Unknown message received from server 10

[root@pxc_5_7 ~]# mysqlsh --sql -uroot --socket=/home/sh/Percona-XtraDB-Cluster-5.7.12-rel5beta-26.16.1.Linux.x86_64/node3/socket.sock --port=33060
Creating a Node Session to root@localhost:33060
Enter password:
No default schema selected.

Welcome to MySQL Shell 1.0.4 Development Preview
[20 Jul 2016 9:16] MySQL Verification Team
Thank you for details, I'm still not seeing the issue even after following earlier steps. Can you enable extra logging? See https://dev.mysql.com/doc/refman/5.7/en/mysql-shell-application-log-introduction.html

mysqlsh --log-level=4 try with even higher values and see exact issue?
[21 Jul 2016 5:34] Shahriyar Rzayev
Sure, 

mysqlsh --sql -umsandbox -pmsandbox --socket=/tmp/mysql_sandbox5713.sock --port=5713 --log-level=8

2016-07-21 05:32:34: Warning: Closing session: msandbox@localhost:5713
2016-07-21 05:32:34: Error: Can't parse  Error (2027): Unknown message received from server 10

2016-07-21 05:32:34: Error: MySQL Error (2027): Unknown message received from server 10
[27 Jul 2016 13:13] Sveta Smirnova
I hit this issue too.

$ mysqlsh --version
MySQL Shell Version 1.0.4 Development Preview
$ mysqlsh -u root -h 127.0.0.1 -P13011 --classic --dba enableXProtocol
Creating a Classic Session to root@127.0.0.1:13011
Enter password:
No default schema selected.

enableXProtocol: Installing plugin mysqlx...
enableXProtocol: done
d$ mysqlsh -u root -h 127.0.0.1 -P13011 
Creating an X Session to root@127.0.0.1:13011
Enter password:
MySQL Error (2027): Unknown message received from server 10
[27 Jul 2016 20:36] Sveta Smirnova
In my case error happened, because I connected to default port, not mysqlx_port. However error message could be less cryptic.
[28 Jul 2016 6:16] MySQL Verification Team
Thank you Sveta!
Fully agree, message could have been meaningful.

-- 1.0.4

root@ubuntu1604lts:~# mysqlsh -u root -h localhost -p --classic --dba enableXProtocol
Creating a Classic Session to root@localhost:3306
Enter password:
No default schema selected.

enableXProtocol: Installing plugin mysqlx...
enableXProtocol: done

root@ubuntu1604lts:~#  mysqlsh --uri root@localhost -p
Creating an X Session to root@localhost:33060
Enter password:
No default schema selected.

Welcome to MySQL Shell 1.0.4 Development Preview

Copyright (c) 2016, 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.

Currently in JavaScript mode. Use \sql to switch to SQL mode and execute queries.
mysql-js> \q
Bye!

-- with mysqld port

root@ubuntu1604lts:~# 
root@ubuntu1604lts:~# mysqlsh -u root -h 127.0.0.1 -P3306
Creating an X Session to root@127.0.0.1:3306
Enter password:
MySQL Error (2027): Unknown message received from server 10
root@ubuntu1604lts:~# 

-- with non-mysqld or non-available port

root@ubuntu1604lts:~# mysqlsh -u root -h 127.0.0.1 -P16116
Creating an X Session to root@127.0.0.1:16116
Enter password:
MySQL Error (2002): Connection refused connecting to 127.0.0.1:16116

Regards,
Umesh