Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL: SyntaxError: Unexpected identifier

Tags:

sql

mysql

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?

like image 272
Slaknation Avatar asked Jun 01 '18 14:06

Slaknation


People also ask

How do you fix an unexpected identifier?

To solve the "Uncaught SyntaxError: Unexpected identifier" error, make sure you don't have any misspelled keywords, e.g. Let or Function instead of let and function , and correct any typos related to a missing or an extra comma, colon, parenthesis, quote or bracket.

What is js mode in MySQL?

The active mode determines how the executed statements are processed: If using SQL mode, statements are processed as SQL which means they are sent to the MySQL server for execution. If using JavaScript mode, statements are processed as JavaScript code.

What is Mysqlsh?

MySQL Shell is an advanced command-line client and code editor for MySQL. In addition to SQL, MySQL Shell also offers scripting capabilities for JavaScript and Python. For information about using MySQL Shell, see MySQL Shell 8.0.


1 Answers

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

like image 118
Max Carroll Avatar answered Sep 23 '22 08:09

Max Carroll