MySQL syntax error 1064 for "SELECT * FROM System" - mysql

I'm using MySql v8.0 and I'm having a syntax error for a simple command like this:
SELECT * FROM System
Then I have an error like this:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'System
select * from System' at line 1
But if I change my command to
SELECT * FROM someSchema.System
it works.
My colleagues said they have no problem of SELECT * FROM System but their MySql version is 5.7.
I'd like to see if this is a version change between MySql 5.7 and 8.0 or there is some setting for my MySql setup? How can I avoid explicitly writing my schema name?

System is a reserved word, try with
SELECT * FROM `System`

Related

Create database in SQL and get an error but everything right

I try to install fleetspeak. Use Ubuntu 18.04.
First of all I run this
CREATE USER 'fleetspeak-user' IDENTIFIED BY 'fleetspeak-password';
Then I want to create database with this
CREATE DATABASE 'fleetspeak';
But has an error:
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near ''fleetspeak'' at line 1
Why I can get this?
Try the create database script without single quotes in dbname
CREATE DATABASE fleetspeak;

MySQL commands not working in phpMyAdmin

I am able to create databases and tables using the User Interface in phpMyAdmin , but when I do the same using MySQL commands , It does not work. I get this error :
SQL query:
DROP DATABASE 'alphacrm'
MySQL said: Documentation
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''alphacrm'' at line 1**
don't use quote
DROP DATABASE alphacrm;
my sql object don't need quotes eventually use backtics for reversed word and compite named eg:
`my obj`

I am trying to insert into a table using "&" operator in MySql

I am using Server version: 5.6.26 MySQL Community Server (GPL).I am trying to insert into subodh table using & operator using following query
insert into subodh values(&date_of_birth,&name,&age,&qualification,&id);
but it is showing the following error
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '&date
_of_birth,&name,&age,&qualification,&id)' at line 1
please help me.
Thanks

Xcart error caused by sql syntax

I am running my store under Xcart and I get following error on top of web browser:
INVALID SQL: 1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_MAX_JOIN_SIZE=1073741824' at line 1
SQL QUERY FAILURE:SET OPTION SQL_MAX_JOIN_SIZE=1073741824
INVALID SQL: 1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_BIG_SELECTS=1' at line 1
SQL QUERY FAILURE:SET OPTION SQL_BIG_SELECTS=1
INVALID SQL: 1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_BIG_SELECTS=1' at line 1
SQL QUERY FAILURE:SET OPTION SQL_BIG_SELECTS=1
what cause this so I can clear the error?
thanks!
It seems your MySQL server has been updated.
Replace all strings like
'SET OPTION SQL_MAX_JOIN_SIZE'
to these
'SET SESSION MAX_JOIN_SIZE'
A command for the unix-based hostings
sed -i 's/SET OPTION /SET SESSION /' $(grep --include='*.php' -rl 'SET OPTION ' ~/www/xcart_4_6_x)
It needs to check the xcart php scripts where this query is executed and OPTION to be replaced with SESSION for the errors like
SQL QUERY FAILURE:SET OPTION SQL_BIG_SELECTS=1
Also, as for
SQL QUERY FAILURE:SET OPTION SQL_MAX_JOIN_SIZE=1073741824
it might worth to change it just to db_query("SET max_join_size=1073741824");
It works for some xcart installations so please report if it helps to your project as well, thanks

Output query result to file?

The below query works
SELECT *
FROM some_table
LIMIT 1
INTO outfile 'some_file.txt';
but how would you write the result of this statement to file
SHOW ENGINE INNODB STATUS INTO OUTFILE 'some_file.txt'
or any other show statements, getting error using into outfile?
Error message:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE "some_file.txt"' at line 1
You CANNOT. INTO OUTFILE can be used only with SELECT STATEMENT... hence you're getting 1064 (syntax-error). Please refer to the documentation here: https://dev.mysql.com/doc/refman/5.1/en/select-into.html
It always says-"SELECT ... INTO OUTFILE..."
You need to use console in order to get output of SHOW commands or anything apart of 'SELECT' statement. Here's how you do it:
Follow the syntax below:
mysql --user root --password=sunny -e"show databases">"D:\\test\\OutFile.txt";
Above statement will give your all the databases in outfile.
mysql --user root --password=sunny --database=mydb -e"describe myTable">"D:\\test\\OutFile.txt";
This will output the description of your table.
HTH !