The MySQL Development team is proud to announce a new version of the MySQL Shell which in addition to the usual bug fixes and enhancements to the existing components, offers new features we expect are quite useful in your day to day work.
The main additions on this release include:
- Support for executing MySQL Shell (API) commands directly from the command line, without entering the interactive REPL interface.
- Introduction of a JSON Import utility.
API Command Line Integration for DevOps
The MySQL Shell offers a set of components in the form of JavaScript and Python APIs which enable developers to create custom scripts to handle specific use cases.
In this release, we made possible to call the functionality on some of the global objects in an easy way without having to enter into the REPL interface.
This can be done by specifying the object, function name and function parameters as independent command line arguments.
The functionality integrated into the command line includes:
- AdminAPI: the functions available in the dba and cluster global objects.
- Credential Management: through the functions in the shell object.
- Shell option handling, through the functions in the shell.options object.
- Server Upgrade verification and JSON import through the utils object.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
$ mysqlsh -- util checkForServerUpgrade root:@localhost:33070 The MySQL server at localhost:33070 will now be checked for compatibility issues for upgrade to MySQL 8.0.13... MySQL version: 8.0.12-commercial - MySQL Enterprise Server - Commercial 1) Usage of partitioned tables in shared tablespaces No issues found 2) Usage of removed GROUP BY ASC/DESC syntax No issues found 3) Issues reported by 'check table x for upgrade' command No issues found Errors: 0 Warnings: 0 Notices: 0 No known compatibility errors or issues were found. $ |
Help about this topic is available by executing the following command in an interactive session.
1 |
mysqlsh-js> \? cmdline |
Stay Tuned: A blog post is coming with details about this feature!
JSON Import
A new utility has been introduced to ease the task of importing data into a MySQL Database either into a MySQL Document Store Collection or a traditional Table.
The data is loaded from a text file containing JSON documents and through different options, you can configure the target table or collection where the data will be loaded.
This utility is available at the util global object.
Help about this topic is available by executing the following command in an interactive session.
1 |
mysqlsh-js> \? importJson |
For more details: take a look at Import JSON to MySQL made easy with the MySQL Shell.
Misc Enhancements
Existing components have been improved to support features and changes available on external components such as the Server and Group Replication.
Upgrade Checker
A new Server release comes with changes that impact the upgrade process from previous releases. The Upgrade Checker utility has been updated to keep the pace of changes and to fully report required changes when migrating to an 8.0.13 Server.
AdminAPI
In 8.0.13, Group Replication introduces new features that improve the usability and configuration capability for InnoDB Clusters.
On the MySQL Shell side, the AdminAPI has been extended to fully support these new features. These changes include adding options to the dba.createCluster(…) and cluster.addInstance(…) functions to define:
- A priority to be used when the new primary election process takes place in clusters running in single-primary-mode.
- Allow defining the exit action for an instance that gets removed from an InnoDB Cluster.
For more details: take a look at MySQL InnoDB Cluster – What’s new in the 8.0.13 (GA) release.
Pager Support
Two common tasks in the shell include result dumping and help display. It is also common that, in both cases, the amount of text printed is long scrolls down until it is fully displayed. As a result, users need to scroll up to see the initial details of the output.
With pager support, the MySQL Shell can be configured so that the output is printed in parts.
With a configured pager, the user can see page by page and has control about when the next page should be printed or even if the printing should be aborted.
For more details about using this feature execute the following command at the MySQL Shell:
1 |
mysqlsh-js> \? \pager |
Additional information is also available on the MySQL Shell User Guide.
Connection Timeout
So far the MySQL Shell did not support establishing a connection timeout in any of the mechanisms available to establish a session. A new connection option has been introduced to support this, when no timeout is specified, a default timeout of 10 seconds will be used.
Details about the connection timeout are included on the different mechanisms to establish a session. Also you can execute the following command:
1 |
mysqlsh-js> \? connection |
Resources
For details about the MySQL Shell please take a look at the MySQL Shell User Guide.
For additional details about features introduced at this version and the full list of fixed bugs take a look at the Release Notes.
Don’t forget to download it and give it a try, your feedback is very welcome!
You can reach us at #shell channel in https://mysqlcommunity.slack.com/