How to install MySQL shell on Ubuntu

# sudo apt-get install mysql-shell

Reading package lists... Done

Building dependency tree

Reading state information... Done

E: Unable to locate package mysql-shell

This means that we don't have MySQL APT repository configuration package installed (MySQL APT repository is not in system's software repository list). 

 

We need to go to download package for the MySQL APT repository from

https://dev.mysql.com/downloads/repo/apt/

 

#  sudo dpkg -i mysql-apt-config_0.8.26-1_all.deb

Selecting previously unselected package mysql-apt-config.

(Reading database ... 71231 files and directories currently installed.)

Preparing to unpack mysql-apt-config_0.8.26-1_all.deb ...

Unpacking mysql-apt-config (0.8.26-1) ...

Setting up mysql-apt-config (0.8.26-1) ...

 

# sudo apt-get update

Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease

Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]

Get:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]

Get:4 http://repo.mysql.com/apt/ubuntu focal InRelease [12.8 kB]

Get:5 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]

Get:6 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2917 kB]

Get:7 http://repo.mysql.com/apt/ubuntu focal/mysql-8.0 Sources [966 B]

Get:8 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [2419 kB]

Get:9 http://repo.mysql.com/apt/ubuntu focal/mysql-apt-config amd64 Packages [565 B]

Get:10 http://repo.mysql.com/apt/ubuntu focal/mysql-8.0 amd64 Packages [10.7 kB]

Get:11 http://repo.mysql.com/apt/ubuntu focal/mysql-tools amd64 Packages [3848 B]

Fetched 5701 kB in 4s (1509 kB/s)

Reading package lists... Done

 

# sudo apt-get install mysql-shell

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following NEW packages will be installed:

  mysql-shell

0 upgraded, 1 newly installed, 0 to remove and 387 not upgraded.

Need to get 21.3 MB of archives.

After this operation, 214 MB of additional disk space will be used.

Get:1 http://repo.mysql.com/apt/ubuntu focal/mysql-8.0 amd64 mysql-shell amd64 8.0.34-1ubuntu20.04 [21.3 MB]

Fetched 21.3 MB in 3s (7504 kB/s)

Selecting previously unselected package mysql-shell:amd64.

(Reading database ... 71236 files and directories currently installed.)

Preparing to unpack .../mysql-shell_8.0.34-1ubuntu20.04_amd64.deb ...

Unpacking mysql-shell:amd64 (8.0.34-1ubuntu20.04) ...

Setting up mysql-shell:amd64 (8.0.34-1ubuntu20.04) ...

Processing triggers for man-db (2.9.1-1) ...

Processing triggers for libc-bin (2.31-0ubuntu9.2) ...

 

To verify that MySQL shall was successfully installed:

# mysqlsh

MySQL Shell 8.0.34

 

Copyright (c) 2016, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates.

Other names may be trademarks of their respective owners.

 

Type '\help' or '\?' for help; '\quit' to exit.

 MySQL  JS >