随笔 - 404  文章 - 4  评论 - 0  阅读 - 25万

【MySQL Shell】MySQL Shell体验

 

二进制包下载:https://downloads.mysql.com/archives/shell/

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select user,host from mysql.user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+-----------+
4 rows in set (0.00 sec)

MySQL需要新增root@"127.0.0.1"用户,权限与root@localhost相同。

下载软件包: mysql-shell-8.0.27-linux-glibc2.12-x86-64bit.tar.gz

$tar -Jxf mysql-shell-8.0.27-linux-glibc2.12-x86-64bit.tar.gz

$ cd mysql-shell-8.0.27-linux-glibc2.12-x86-64bit/bin/
$ ls
mysql-secret-store-login-path mysqlsh
$ ./mysqlsh

MySQL Shell 8.0.27

Copyright (c) 2016, 2021, 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 >

shell中连接指定用户端口

 

$ ./mysqlsh root@localhost:3306

#连接到指定数据库

MySQL localhost:3306 ssl JS > \use mysql
Default schema set to `mysql`.
MySQL localhost:3306 ssl mysql JS > \s
MySQL Shell version 8.0.27

Connection Id: 40
Current schema: mysql
Current user: root@127.0.0.1
SSL: Cipher in use: TLS_AES_256_GCM_SHA384 TLSv1.3
Using delimiter: ;
Server version: 8.0.27 MySQL Community Server - GPL
Protocol version: Classic 10
Client library: 8.0.27
Connection: localhost via TCP/IP
TCP port: 3306
Server characterset: utf8mb4
Schema characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
Result characterset: utf8mb4
Compression: Disabled
Uptime: 43 min 14.0000 sec

Threads: 2 Questions: 85 Slow queries: 0 Opens: 1086 Flush tables: 3 Open tables: 104 Queries per second avg: 0.032
MySQL localhost:3306 ssl mysql JS >

shell中连接指定数据库
$ ./mysqlsh root@localhost:3306/mysql

 

posted on   HelonTian  阅读(213)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
历史上的今天:
2018-03-29 ERROR 1146 (42S02): Table 'mysql.servers' doesn't exist
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示