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`
Related
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;
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`
I'm trying to copy database from one server to another like this
mysqldump -u<source_db_username> -p<source_db_password> -h<source_db_ip_address> source_database_name
| mysql -u<target_db_username> -p<target_db_password> -h<aws_rds_endpoint> <aws_rds_db_name>;
But I get
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 'mysqldump -u<source_db_username> -p<source_db_password>
-h<source_db_ip_address> source_database_name ' at line 1
I shouldn't use the database while copying I just have to refer the mysql location to use it and shouldn't use ';' at the end of the command it's working now.
In console I am trying to drop database using command
drop database database_name;
But it's throwing the below 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 'database check' at line 1
I also tried to use another command:
mysqladmin -u root -p drop check;
It is throwing an error below
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 'mysqladmin -u root -p drop check' at line 1
How to fix it?
CHECK is a reserved word in MySQL, you should use back-tick character to escape it:
DROP DATABASE `check`;
In future, try to avoid using reserved words as names of tables/databases to prevent such things from happening.
I am using MAMP with MySQL server ver 5.5.42.
When I do an Alter table using phpMyAdmin on the MAMP server:
ALTER TABLE config DROP COLUMN 132
I get
#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 'config' DROP COLUMN 132' at line 1
Where is the problem ?
Turns out it should be:
ALTER TABLE `config` DROP COLUMN `132`
`--> the accent or backquote character on the tilde key. :|