LinuxCommandLibrary

mysqlsh

Advanced command-line client for MySQL, supporting SQL, JavaScript, and Python.

TLDR

Start MySQL Shell in interactive mode

$ mysqlsh
copy


Connect to a MySQL server
$ mysqlsh --user [username] --host [hostname] --port [port]
copy


Execute an SQL statement on the server and exit
$ mysqlsh --user [username] --execute '[sql_statement]'
copy


Start MySQL Shell in JavaScript mode
$ mysqlsh --js
copy


Start MySQL Shell in Python mode
$ mysqlsh --py
copy


Import JSON documents into a MySQL collection
$ mysqlsh --import [path/to/file.json] --schema [schema_name] --collection [collection_name]
copy


Enable verbose output
$ mysqlsh --verbose
copy

Copied to clipboard