MySQL Shell

In Note 1369139.1 Oracle make this statement...

"Due to the easier maintenance when using the RPM installations, Oracle recommends using these if possible, although considerations such as installing into a non-default location will tend to favor using the tar-ball."


Opinion: In an Enterprise environment where separate teams are responsible for OS and database and where an Enterprise Management solution is in place to raise automated alerts on conditions such as filesystems filling, I believe the tar-ball installation can help maintain clear lines of responsibility (e.g. if /mysql filesystem usage breaches a threshold then DBA team will be engaged, if /opt usage breaches a threshold then UNIX team will be engaged. Also, UNIX patching can be done on a separate schedule to MySQL patching, thus helping support teams more easily identify root cause of issues associated with the patches and allowing MySQL patches to be delayed whilst they are tested on other servers without impacting critical OS level patching). Note that you can have the best of both worlds by making the default install location a separate mount point.

The steps shown are based on a tarball installation for Oracle Enterprise Linux 7

TAR

cd /mysql

unzip ${ZIPFILE}

tar xvf ${TARFILE}.tar.gz
ln -s ${TARFILE} mysql-shell
mv README.txt mysql-shell
rm -f ${TARFILE}.tar.gz
rm -f ${TARFILE}.tar.gz.asc
rm -f ${TARFILE}.tar.gz.md5
rm -f ${ZIPFILE}.zip
export PATH=/mysql/mysql-shell/bin:$PATH

Add this to the .bash_profile for the root user

8.0.23 (EL7)

ZIPFILE=V1006325-01.zipTARFILE=mysql-shell-commercial-8.0.23-linux-el7-x86-64bit

8.0.24 (Generic)

ZIPFILE=V1008315-01.zip8.0.25ZIPFILE=V1009127-01.zip

8.0.26 (Generic)

ZIPFILE=V1010708-01.zip
TARFILE=mysql-shell-commercial-8.0.26-linux-glibc2.12-x86-64bit
8.0.27 (Generic)ZIPFILE=V1018107-01.zipTARFILE=mysql-shell-commercial-8.0.27-linux-glibc2.12-x86-64bit8.0.28 (Generic)ZIPFILE=V1019496-01.zipTARFILE=mysql-shell-commercial-8.0.28-linux-glibc2.12-x86-64bit
If you get this error (expected on 8.0.28 and, possibly, 8.0.29)...mysqlsh: symbol lookup error: /lib64/libk5crypto.so.3: undefined symbol: EVP_KDF_ctrl, version OPENSSL_1_1_1bDo this...mv /mysql/mysql-shell/lib/mysqlsh/libcrypto.so.1.1 /mysql/mysql-shell/lib/mysqlsh/libcrypto.so.1.1.old

RPM

8.0.23V1006320-01.zip - MySQL Shell 8.0.23 RPM for Oracle Linux / RHEL 7 x86 (64bit), 241.4 MB V1006322-01.zip - MySQL Shell 8.0.23 RPM for Oracle Linux / RHEL 8 x86(64bit), 245.5 MB

APT (Ubuntu)

sudo apt update

sudo apt install mysql-shell

YUM (OEL/RHEL)

yum install mysql-shell

Commands

mysqlsh

\c root@localhost

\q

Help

\h

session.help()

session.help('getSchemas')

dba.help('getCluster')

Interpreters

\py

\sql

\js

shell.options.setPersist('defaultMode','sql')

Databases

\js

session.getSchemas()

\py

session.getSchemas()

\sql

show databases;

Innodb Cluster

var cluster = dba.getCluster('myCluster');

cluster.status()

cluster.describe()

cluster.options()

dba.checkInstanceConfiguration()

dba.configureLocalInstance()

cluster.addInstance('icadmin@node2:3306')

cluster.switchToMultiPrimaryMode()

cluster.switchToSinglePrimaryMode()

cluster.setPrimaryInstance('node3')

cluster.setupRouterAccount('icadmin', {'update':1})

cluster.listRouters()

dba.upgradeMetadata()

History

\option --persist history.autosave 1

Start mysqlsh

Connect to local database server as root@localhost

Quit


help

methods for 'session' object

help with 'getSchemas' method of 'session' object

help with 'getCluster' method of 'dba' object


invoke Python interpreter

invoke SQL interpreter

invoke javascript interpreter

Set SQL interprester as default


javascript

Show Databases

python

Show Databases

SQL

Show Databases


Define 'cluster' object

Cluster Status

Describe cluster

Cluster options

Check Instance Configuration

Configure Local Instance

Add instance (needs extra options, see InnoDB cluster page)

Multiple R/W Primary mode

One R/W, multiple RO

Set Primary instance

Setup a Router account

List Routers

Upgrade Metadata


Persist shell history between sessions

Bibliography