MySQL Shell 8.0.18 – What’s New?

The MySQL Development team is proud to announce a new version of the MySQL Shell with the following major improvements:

  • Migration to Python 3
  • Built-in thread reports
  • Ability to use an external editor
  • Ability to execute system commands within the shell
  • Admin API Improvements:
    • New options to log all the SQL used on the different operations
    • Support for IPv6 in InnoDB Clusters
    • New function to reset the InnoDB Cluster recovery accounts
  • General maintenance and bug fixing

Python 3 Migration

Due to the coming end-of-life (EOL) for Python 2.7 by end of this year, the Shell has been updated to use Python 3.

Be aware that any code written for Shell 8.0.17 and lower which used Python 2.7 may not be fully compatible with Shell 8.0.18. In case you get affected by this, please refer to the Python 3.0 What’s New for details about the most stumbling changes.

The minimum supported version is Python 3.4.3. On platforms where system support for Python 3 is not available the Shell packages bundle Python 3.7.4.

Built-in Thread Reports

Since the early days of MySQL, SHOW PROCESSLIST has been the first place to look for clues about misbehaving client sessions and unexpected performance problems. It’s simple and does the job in many cases, but sometimes there’s a need to dig deeper. performance_schema has an incredible amount of data about what and how is MySQL executing client queries (now and in the past), but quickly extracting useful information from it can be a little cumbersome even for experienced users.

To bridge the gap between SHOW PROCESSLIST and performance_schema, the Shell now includes 2 new reports to its built-in \show command: \show threads and \show thread.

\show threads is similar to SHOW PROCESSLIST in which it prints a list of client sessions and attributes for each of them, but allows including a lot of other information, such as:

  • session connect attributes (which includes the name of the program, client library, PID, OS etc)
  • amount of memory allocated for the session
  • context about the transaction being executed
  • metadata and row locks being held
  • amount of time spent waiting for I/O
  • etc.

\show thread allows inspecting individual sessions in more detail, including information that you can also view with \show threads, but without being constrained by the width of your screen. You can still filter the output to show exactly what you want, but you can show everything at once with –all.

For example, in the following screenshot, \show thread reveals that a client is hanging without doing anything because it’s waiting on a metadata lock held by another client:

For additional information about the built reports refer to the MySQL Shell User Guide or the built-in help by executing any of the following on the MySQL Shell prompt:

  • \? thread
  • \? threads

External Editor

The introduction of the \edit (\e) Shell Command allows using an external editor to either edit the current statement or the last executed statement.

The external editor to be used can be configured through the EDITOR and VISUAL environment variables (in that order). If no custom editor is specified the shell will use the following by default:

  • Notepad on Windows
  • Vi on other platforms

The external editor can also be invoked through the following shortcut: CTRL+X+E.

For additional information refer to the User Guide or the built in help by executing the following in the MySQL Shell prompt: \? \edit

System Commands

The new \system (\!) Shell Command enables the user to execute system commands right away within the MySQL Shell.

The command given to the \system Shell Command will be executed at the operating system level and the MySQL Shell will display whatever output generated by the command.

For additional information refer to the User Guide or the built in help by executing the following in the MySQL Shell prompt: \? \?system

Admin API Improvements

Bing one of the core components of the shell, the Admin API continues growing both in in quality and functionality. In addition to the maintenance work done on it (bug fixing), improvements have been added in the following areas:

  • Networking: by extending the AdminAPI to fully leverage the cluster’s capabilities to use IPv6.
  • Security: by providing a new command to refresh/reset the cluster’s internal recovery accounts passwords.
  • Troubleshooting/observability: by extending Shell’s logging system to provide information about all SQL statements executed by the AdminAPI, and also by including information about replication-lag in the cluster’s status command.

For details about the enhancements on the Admin API and the InnoDB Cluster 8.0.18 refer to MySQL InnoDB Cluster – What’s new in Shell AdminAPI 8.0.18 release.

Resources

For details about the MySQL Shell please take a look at the MySQL Shell User Guide.

For additional details about features introduced by 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/

About Rene Ramirez

Juan Rene Ramirez Monarrez (a.k.a. rennox) is a Software Engineer with a master degree in Computer Science residing in Mexico. He started his career at IBM almost 20 years ago in application development, had a pass on Automation at Freescale Semiconductor (now MXP) and landed at the MySQL world 8 years ago. At MySQL he started working at the Workbench team and now is leading the efforts to make the MySQL Shell the client by excellence for different MySQL products.

Leave a Reply