MySQL: SyntaxError: Unexpected identifier
I just installed MySQL on my computer and when I try to create a database from the MySQL shell, I get this error:
MySQL JS > CREATE DATABASE databasename;
SyntaxError: Unexpected identifier
Does anyone know why this is happening? Is there a problem with the installation of MySQL?
Solution 1:
By looking at this thread here, it looks like you might be using the shell in js mode, you might be able to toggle it off by using the switch
\sql
https://forums.mysql.com/read.php?10,661192,661203#msg-661203
Solution 2:
You can type:
Mysql JS> \sql
Mysql SQL> \connect root@localhost
and provide your password.
Solution 3:
Logging in as follows did work as shown by Rahul in another answer:
Mysql JS> \sql
Mysql SQL> \connect root@localhost
However, I was able to get Mysql>
instead of Mysql JS>
or Mysql SQL>
by opening the Windows command prompt and entering the following:
mysql -u root -p