“-bash: mysql: 未找到命令”- 尝试连接到远程 MYSQL 数据库

"-bash: mysql: command not found" - Trying to connect to remote MYSQL database

我已经在 aws、amazon aurora 上设置了一个远程 MYSQL 数据库。我正在尝试从我的终端访问它,但我在终端上收到以下错误消息:

 "-bash: mysql: command not found"

 RDSHOST="rdsmysql.cdgmuqiadpid.us-west-2.rds.amazonaws.com"
 TOKEN="$(aws rds generate-db-auth-token --hostname $RDSHOST --port 3306 --region us-west-2 --username jane_doe )"

 mysql --host=$RDSHOST --port=3306 --ssl-ca=/sample_dir/rds-combined-ca-bundle.pem --enable-cleartext-plugin --user=jane_doe --password=$TOKEN

我需要下载什么 MySQL 软件包才能访问 mysql 命令。我的计算机上不需要 MySQL 数据库,因为我正在尝试访问远程数据库。

如果您没有在本地安装 MySQL 软件,则无法使用 mysql 客户端。一些 Linux 发行版分裂 server/client,其他发行版将它们混为一谈。 Windows 和 macOS 往往随附完整的套件。

仅仅因为您已经下载了服务器软件并不意味着您需要 运行 它。

对于在本地机器上使用 aurora docker 的人,您也会遇到此错误,要解决此问题,您可以在:

中执行 ./mysql -u root -p
mysql@60b5bd261443:/opt/mysql/server-5.6/bin$./mysql -u root -p

而且 bim 你在 mysql 你可以做任何你想做的事:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.10 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| test               |
+--------------------+
2 rows in set (0.01 sec)

mysql>