Starting sql shell in aws instance to access Nakama database

I have Nakama server installed on my mac via docker. I used ‘cockroach sql --insecure’ to handle Nakama’s Database on my system without any issues.
I wanted to have the same set-up on an AWS linux instance.I successfully installed Nakama on AWS instance but when I tried to access the database by typing ‘cockroach sql --insecure’ command as I did on my mac pc I am got the error that
’-bash: /usr/local/bin/cockroach: No such file or directory’
and when I installed cockroach db after that and ran the same command ‘cockroach sql --insecure’ I got the following error

#Welcome to the cockroach SQL interface.
#All statements must be terminated by a semicolon.
#To exit: CTRL + D.

Error: pq: unknown variable: "sql_safe_updates"
Failed running “sql”

How can I solve this issue?

I believe this would happen if you are using a new cockroach binary to run cockroach sql and the server is older. Make sure they are the same version.

You can use cockroach sql --insecure --unsafe-updates as a workaround to this particular error, but there may be other problems. I would recommend running a server with a recent version.

We are tracking the fixing of incompatibilities between different versions of the sql client and the server in https://github.com/cockroachdb/cockroach/issues/19445.

Actually I solved the issue by using “docker exec” command. I ran docker exec my_container_name ./cockroach sql --insecure
and it worked.
But still thank you so much for replying.

That makes sense, the version you have in the docker container is probably newer.