How to find the file causing a mysql syntax error - mysql

I'm a newbie. I just set up Ubuntu to run on my Chromebook (via Crouton) last week and am currently in the process of setting up several Wordpress sites on localhost. I successfully installed a new Wordpress site yesterday, and I'm able to access the frontend and backend of the site via localhost no problem.
Today I wanted to create another Wordpress site. But when I try to create a new database in mysql using Terminal, I get the following error:
mysql> CREATE DATABASE;
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 '' at line 1
How do I figure out which file is causing the syntax error? I checked php.ini, which I edited yesterday, but line 1 looks fine.

The right way to use Mysql CREATE DATABASE statement
CREATE DATABASE my_db;

To my belief, you are missing the database name:
mysql>CREATE DATABASE database_name;

Related

Sql Syntax error with Doctrine, probably because of change of Mysql version

I've programmed a project in symfony and mysql 5.6. then I uploaded my project to a remote server on 1&1. the remote server has mysql 5.7 version. All doctrine queries run ok and without problem. But when a user searches something, a request will be sent to the server and a doctrine query will be executed. Here it returns the following error:
SQLSTATE[42000]: Syntax error or access violation: 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 'integer)
BETWEEN 1940 AND 2002) AND u0_.id <> 2' at line 1
I think, it is probably because of different versions of mysql. Because on localhost it runs without problem
Can you please help me how to solve it? is there a way to regenerate all the migrations according the new mysql version? or may be there is another solution?
thanks
I was using CAST('number' as integer) in mysql 5.6. It did ok. However in mysql 5.7 and I do not know why, it does not run ok. So I changed it to CAST('number' as UNSIGNED) and it works ok

Error when importing SQL Dump from an equal source

I need to sync the database of a live server to our development system, so I did create a dump with mysqldump, zipped it, piped it to the other server, unzipped it and wanted to import said dump. Quite the no-brainer, right?
mysql -uroot -pPASS DBNAME < dump.sql
This is where the error occurs.
ERROR 1064 (42000) at line 270: 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 ''{\n \"parsed_parameters\":91,\n \"max_result\":[\n {\"time\":5076987.68,\"outp' at line 1
Edit: This does also happen if I use the MySQL CL with source.
This is odd, as every technical aspect of the live system is equal to the dev system, the only difference is the backend and the data in the database.
So I am wondering why I can't insert this dump despite having a comparable database with the same schema as the source.
Edit: Just for testing I created an empty database and got the same error.
But the thing I don't get is, that the process successfully imported exactly 500 rows with similar values. Maybe there is something with this 500 rows threshold?
You need to login first using below cmd
mysql -u <your-username> -p
After click enter it will asking for password please enter it, then using below you can import dump in specific schema.
use <schema-name>;
source database/filepath/dump.sql;
If you have not created schema then create it using below cmd first after login.
create schema your_schema_name;

MySQL Workbench / Forward Engineering Progress - Error

So i have a little problem while learning MySQL/PHP.
I have installed XAMPP and the MySQL Workbench, in order to learn (play around) some basic SQL/PHP stuff.
My XAMPP shows that my SQL server is up and running (it clearly says MySQL), but nonetheless, i get an error, each time i try to implement a schema on my sql-server.
As for now, i have only used the EER/Forward Engineering method of implementing a database with the MySQL-Workbench. Each time i try to complete the process after modelling the EER model, i get errors like this:
Executing SQL script in server
ERROR: Error 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 ')
Does anyone here have an idea how to fix this?
Greetings.
Thats what the generated SQL looks like
I also tried setting the "Target SQL Version" in the Model preferences to 5.6, as well as overall preferences.
As a little desperation move, i deinstalled XAMPP and the MySQL Workbench, and installed the newest versions - XAMPP (7.3.8 , using MariaDB) and the Workbench (8.0.17)
What am i missing?

#1064 error in importing database php mysql localhost

I have backup of my live site's database. I want to run it on localhost. I tried to import the back up database that I craeted in phpmyadmin/localhost. But I am getting error something like this:
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 '
"http://www.w' at line 1
Can Any one help me....
This doesn't look like an SQL file, but as Krister Andersson suggested, you should post a few lines so we can see exactly what you are dealing with. How did you create the backup? What file type does it claim to be (is there an extension on the file)?

Use database google cloud mysql

Hi I am new mysql and Google cloud SQL. I created a database and now can't seem to use it. Please see the list of commands below which leads to the error
Google SQL Client
Type "help" or "?" for help.
Connecting to Google SQL database "evident-castle-346:pocsql01" on host None.
Using readline for history management.
Loading history file "/Users/*********/.googlesql/evident-castle-346#pocsql01.hist"
sql> show database
Database: evident-castle-346:pocsql01
Vendor: MySQL AB
Product: MySQL
Version: 5.5.34
sql> use evident-castle-346:pocsql01;
ERROR:google_sql:(1064, u"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 '-castle 346:pocsql01' at line 1")
sql>
I can't seem to figure out what the error in my syntax is.
Please help