简体   繁体   中英

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

I have set up a remote MYSQL database on aws, amazon aurora. I am trying to access it from my terminal and I am getting the following error message back on the terminal:

 "-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

What MySQL package do I need to download to have access to the mysql command. I do not need a MySQL database on my computer as I am trying to access a remote one.

If you don't have the MySQL software installed locally you can't use the mysql client. Some Linux distributions split server/client, others lump them all together. Windows and macOS tend to come with the complete kit.

Just because you've downloaded the server software as well doesn't mean you need to run it.

For thous who use aurora docker in local machine, you can get this error also, to solve this issue, you can execute ./mysql -u root -p in:

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

And bim you are in mysql and you can do whatever you want:

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM