If like me you are using MySQL Shell on many different systems and new installations, there are some commands I often use to benefit from my environment.
What I really want to enable is the history of course, a nicer prompt and sometimes the default mode I want to use.
This blog post is just a little reminder with those commands I usually repeat in all my systems:
mysql-js> shell.options.setPersist('history.autoSave', 1) mysql-js> shell.options.setPersist('history.maxSize', 5000)
The option above is when using MySQL Shell in JS mode which is the default. To play with options using the same command in every mode (JS, Python, SQL), you can use
\option --persist history.autoSave 1
Then I set the prompt to have something like this:
$ cp /usr/share/mysqlsh/prompt/prompt_256pl+aw.json ~/.mysqlsh/prompt.json
if you are looking for a font where all icons are correctly rendered, I recommend to use Fantasque+powerline+awesome.
You can of course modify the prompt file yourself. Mine is modified to use two lines and display the date and time, like this:
Here is my prompt file:
If you want to use SQL mode by default, you can also set it like this:
mysql-js> shell.options.setPersist('defaultMode', 'sql')
And finally, if you want to have the credentials saved, on Linux, you must have
mysql_config_editor which is distributed with
Thank you for using MySQL Shell !