What Is MySQL Shell

Quick introduction of MySQL Shell and ways to start it and access the local MySQL server.

What Is MySQL Shell? MySQL Shell is an advanced client and code editor for MySQL Server. It allows you to connect to a MySQL Server to run SQL commands, similar to the "mysql" command line tool. It also allows you to run JavaScript and Python scripts to interface with a MySQL Server.

MySQL Shell is included in the "Full" installation using MySQL Installer.

You can start MySQL Shell from Windows "Start" button or from the "C:\Program Files\MySQL\MySQL Shell 8.0\bin\mysqlsh.exe" command.

Make sure MySQL server is running and try the following commands to play with MySQL Shell:

herong> "\Program Files\MySQL\MySQL Shell 8.0\bin\mysqlsh"

MySQL Shell 8.0.16

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

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

 MySQL  JS > print("Hello world!");
Hello world!
 MySQL  JS > \py
Switching to Python mode...

 MySQL  Py > print("Hello world!")
Hello world!

 MySQL  Py > \connect root@localhost
Creating a session to 'root@localhost'
Please provide the password for 'root@localhost': *********
Save password for 'root@localhost'? [Y]es/[N]o/Ne[v]er (default No): N
Fetching schema names for autocompletion... Press ^C to stop.
Your MySQL connection id is 15 (X protocol)
Server version: 8.0.16 MySQL Community Server - GPL
No default schema selected; type \use <schema> to set one.

 MySQL  localhost:33060+ ssl  Py > \sql show databases;
| Database           |
| information_schema |
| mysql              |
| performance_schema |
| sakila             |
| sys                |
| world              |
6 rows in set (0.0005 sec)

 MySQL  localhost:33060+ ssl  Py > \sql select "Hello world!";
| Hello world! |
| Hello world! |
1 row in set (0.0003 sec)

 MySQL  localhost:33060+ ssl  Py > \exit

Table of Contents

 About This Book

 Introduction of SQL

MySQL Introduction and Installation

 What Is MySQL

 Downloading and Installing MySQL

 Issues during MySQL Installation

 Starting and Stopping MySQL Server

 Un-Installing MySQL

 MySQL Command Line Client Tool

What Is MySQL Shell

 What Is MySQL Workbench

 Using MySQL Non-Install Package

 MySQL Data Directory Initialization

 Creating MySQL Windows Service

 %mysql% Variable for MySQL Server Path

 Introduction of MySQL Programs

 PHP Programs and MySQL Server

 Perl Programs and MySQL Servers

 Java Programs and MySQL Servers

 Datatypes and Data Literals

 Operations and Expressions

 Character Strings and Bit Strings

 Commonly Used Functions

 Table Column Types for Different Types of Values

 Using DDL to Create Tables and Indexes

 Using DML to Insert, Update and Delete Records

 Using SELECT to Query Database

 Window Functions for Statistical Analysis

 Use Index for Better Performance

 Transaction Management and Isolation Levels

 Locks Used in MySQL

 Defining and Calling Stored Procedures

 Variables, Loops and Cursors Used in Stored Procedures

 System, User-Defined and Stored Procedure Variables

 MySQL Server Administration

 Storage Engines in MySQL Server

 InnoDB Storage Engine - Primary and Secondary Indexes

 Performance Tuning and Optimization

 Bulk Changes on Large Tables

 MySQL Server on macOS

 Installing MySQL Server on Linux

 Connection, Performance and Second Instance on Linux

 Archived Tutorials


 Full Version in PDF/EPUB