SQL Restore backup file error - mysql

mysql -u root -paaum corpdb < /home/aaum/Videos/sp_getNOnAirDetails1.sql
ERROR 1064 (42000) at line 1: 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 4
i think so there is some problem with my sql file

Try the commands as shown below :
Login into your mysql console and run :
mysql> use corpdb;
mysql> source /home/aaum/Videos/sp_getNOnAirDetails1.sql;
If your dump file is executed perfectly then the issue is not with the file.
It's about how you are trying to import the file.
The command which you have provided is absolutely fine. But I see that probably you might be executing the command from MySQL console.
mysql> mysql -u root -paaum corpdb < /home/aaum/Videos/sp_getNOnAirDetails1.sql
Not a right way to import, try to import the file from terminal.
If you still see any errors then please post them here.

i finally bugged the problem. i forget to assign delimeter .

Related

Dump file error while trying to switch to import to a MySQL

I have a dump file name mydata.dump.sql. Currently using a console of my MYSQL database. To use my data I have tried the source command:
source mydata.dump.sql
I am however getting the 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 'TRANSACTION' at line 7
Query OK, 0 rows affected (0.00 sec)
Not sure what' s wrong with that syntax but the dump file was generated by phpmyadmin, so I guessed it was legit.
Here an excerpt from the dump file that shows line 7 :
----
-- phpLiteAdmin database dump (http://www.phpliteadmin.org/)
-- phpLiteAdmin version: 1.9.7-dev
-- Exported: 10:39pm on May 20, 2017 (UTC)
-- database file: /home/ubuntu/workspace/finale.db
----
BEGIN TRANSACTION;
COMMIT;
In command line you can use:
mysql -u your_username -p database_name < mydata.dump.sql
If you are on windows put full path
USE your db_name;
SOURCE D:/yourfolder/mydata.dump.sql;
Try to replace the name mydata.dump.sql to mydata_dump.sql
Some times also for me phpmyadmin got strange errors.
Many people recommend to use mysqldump to export and then mysql ... to import

getting error 1064 while importing data in phpmyadmin

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 'Usage: mysqldump [OPTIONS] database [tables] OR mysqldump [OPTIONS] --databa' at line 1
I am getting this error while importing my mysql database into phpmyadmin. What can be the reason?
This does not appear to be a valid export/dump/SQL file. If I had to guess, I'd say you redirected the output of mysqldump to a file, but used incorrect syntax when calling mysqldump, causing the error text to redirect to the file instead of the SQL code.
How big is your SQL file?
Try exporting again, being careful to monitor for errors this time. It seems to me you would have had to redirect stderr in this case, which is an odd thing to do, so you could also show us the command line statement you used to create the SQL file.

import large MySQL Database - PHPMyAdmin error

Trying to import a very large database file.
Windows Apache PhpMyAdmin.
USE test;
source somefil.sql;
I get a syntax error:
"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 'source somefil.sql' at line 1 "
There is no such command in mysql server as source. This command is specific to mysql own command line client, which is also named mysql, therefore it is not available in phpmyadmin.
Copy-paste the contents of the sql file into the command window of phpmyadmin and execute its contents directly from there. You may have to increase the php max execution time parameter, if the import file is truly big.
However, I would use the command line client to execute a really big sql file because phpmyadmin is not suitable for that.
to restor backup of my datebase I use command like that
from your os command promt :
mysql -u youruser -p yourdatabasename < yourfilewithfullpath.sql
Actually source command is used from command prompt so Use below steps-
Go to command prompt-
connect mysql
now use below command-
source d:/backup/somefil.sql;

Restoring mysqldump file of another version

I am restoring a mysqldump file to another server. The versions are close, so I didn't expect any problems. I get:
:/var/backups$ sudo mysql -f -u root -p dbasename < backup.sql
Enter password:
ERROR 1064 (42000) at line 542: 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 '' Current\n * President/CEO at Echoingwalls.com\n * Develope' at line 1
Other's solutions with this error message haven't been helpful. How can I detect if my back up is corrupt? I am pretty sure the versions of MySQL have been pretty close (both 5.x).
Any specific instructions on how to restore this would be appreciated.
It seems like you may have an inconsistency between how your systems are escaping single quote;
... use near '' Current\n * Presi ....
^ Note the addtional quote
Do diagnose the problem compare both tables
show create table mytable
And campare the sql modes
SELECT ##GLOBAL.sql_mode;
SELECT ##SESSION.sql_mode;
For more help find the insert statement in the dump file and post the sql.

Unable to create mysql database dump

I am unable to create mysql database dump. I have tried all the commands in the below question
https://stackoverflow.com/questions/24858436/unable-to-create-mysql-dump-in-mysql-server-5-6-19
But every time I get similar error which asks me to check manual
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 'mysql
dump -u root -pmysqlmysql hospital_management -r "c:\hosp.sql"' at line 1
I am trying these commands in Mysql command line and NOT on Windows command prompt. Also I am trying these commands before entering any database in mysql.
mysql> mysqldump -u root -pmysqlmysql hospital_management > hosp.sql
This was the first command I tried, which did not work
mysqldump is an executable, you should not run it in the MySQL command line.
Try the command
mysqldump -uroot -pmysqlmysql hospital_management > "C:\hosp.sql"
By reading the documentation, I assume that when using -r, the file must already exist.