MySQL SyntaxError: Unexpected identifier

In this article, we will see the solution for below error

SyntaxError: Unexpected identifier

MySQL SyntaxError Unexpected identifier

Solution for MySQL SyntaxError: Unexpected identifier


By looking at this thread here, it looks like we might be using the shell in js mode, we might be able to toggle it off by using the switch.

This error is observed in latest MySQL Shell. We can’t directly run the queries after opening MySQL shell. First, we have to switch to \sql mode and connect with the user.

1. Switch to \sql

\sql

2. Now, connect to MySQL user and hostname.

\connect root@localhost

If we want to connect using different user other than root user, run the following command.

\connect david@localhost

So in this article, we have seen solution for MySQL Syntax error i.e. Unexpected identifier.