简体   繁体   中英

MySQL connect to Google Cloud SQL instance syntax error

I am trying to connect to my Google Cloud instance in mysql client as stated in https://cloud.google.com/sql/docs/mysql/connect-admin-ip#connect with the command

mysql --host=[INSTANCE_IP] --user=root --password

and the syntax error shows up as below. What is wrong with the syntax? Mysql client version is 8.0

在此处输入图像描述

Your sql client is already connected, maybe to localhost, try to use CMD and cd dir to the directory of mysql command line client and from there connect to instance

As far as I understand you want to connect to a Cloud MySQL instance to see that everything is OK in order to go ahead and connect your C# code to it.

If you are seeing "mysql>" is because you are connected to that instance.

在此处输入图像描述

As previous answer stated by Stefan G. you're already in the mysql tool. You may or may not be actually connected to the server though. When you have that prompt mysql> type status . It'll tell you whether or not you're connected to an instance or not. There will be a Connection: field in the status output which should be the IP address of your instance.

If it's NOT, then something went wrong at the connection step, and you'll need to run connect <databasename> where is the id of one of the datbases in your instance. See if that errors out as well, and if it does, there's something deeper wrong going on here.

If you ARE connected to the database, you should be able to run SHOW tables; and have it list the tables in your database.

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