← 返回命令列表

Linux command

mysqlsh 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Start MySQL Shell

mysqlsh

Connect to server

mysqlsh -u [username] -h [hostname]

Connect with URI

mysqlsh [mysql://user@host:3306/database]

Execute SQL mode

mysqlsh --sql -u [user] -e "[SELECT 1]"

JavaScript mode

mysqlsh --js

Python mode

mysqlsh --py

Run script

mysqlsh -f [script.js]

说明

mysqlsh is the MySQL Shell client. It provides SQL, JavaScript, and Python interfaces. The tool supports MySQL 8.0 features. Includes AdminAPI for cluster management.

参数

-u _USER_
Username.
-h _HOST_
Hostname.
--sql
SQL mode.
--js
JavaScript mode.
--py
Python mode.
-f _FILE_
Execute script file.
--help
Display help information.

FAQ

What is the mysqlsh command used for?

mysqlsh is the MySQL Shell client. It provides SQL, JavaScript, and Python interfaces. The tool supports MySQL 8.0 features. Includes AdminAPI for cluster management.

How do I run a basic mysqlsh example?

Run `mysqlsh` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -u _USER_ do in mysqlsh?

Username.