I always use these methods to upload my database file from local to phpmyadmin :
Get the .sql file from localhost phpmyadmin
Open that in notepad and change localhost to www.sitename.com
Finally import that .sql file to the site's phpmyadmin
It always worked great without any problems. But this time when I want to import that .sql file it gives me this error :
Error
SQL query:
phpMyAdmin SQL Dump
-- version 3.4.10.1
-- http://www.phpmyadmin.net
Host: localhost
-- Generation Time: Mar 30, 2015 at 12:05 PM
-- Server version: 5.5.20
-- PHP Version: 5.3.10
MySQL said:
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 'phpMyAdmin SQL Dump
-- version 3.4.10.1
http://www.phpmyadmin.net
Host:' at line 1
This time it gives me this error. How I can Fix that?
Thanks
As previous discussion.
Just open sql file in any text editor and remove all host lines and simply copy the data below the line
--
-- Table structure for table
--
and paste the same on MySQL terminal and try.
Also you can use mysqldump command through shell or command prompt.
I found similar error and by looking inside file i saw
2006 - MySQL server has gone away
that mean mysql was not able to execute query completely
you can try tables export one by one or using phpmyadmin
Related
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 .
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
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;
I'm a MySQL/WAMP newbie attempting to set up timezones so that I could follow along with a course on the topic, but then I started having troubles when the instructions I was being given didn't correspond to the info on the MySQL page from which I was to download the setup file, http://dev.mysql.com/doc/refman/5.7/en/mysql-tzinfo-to-sql.html.
Can anyone tell me why, when I attempt to run this command from the mysql command prompt:
mysql -u root mysql < C:/timezone_posix.sql;
I get this 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 'mysql
BTW, I've tried that with both forward and backward slashes, with and without quotes, etc., from my WAMP 5.6.17, MySQL command prompt, and the file in question is the posix (not isam) version that corresponds to the MySQL version on a windows machine.
You should be running that from the regular command prompt, not inside the mysql program, since it runs the mysql program. So it should be at the C:\ prompt.
Or you could use the mysql source command to read from a file:
mysql> use mysql
mysql> source 'C:/timezone_posix.sql'
I am trying to import a new database from an sql dump file with size above 2.6 GB. To do this I am running the below command to import the database from the sql file.
mysql -u root -proot --database=test_db < test_db.sql
and the error response I got at this time.
ERROR 2006 (HY000) at line 51: MySQL server has gone away
I think the problem over here is some timeout is happening somewhere. Only one table has creatd in the new database from the sql file. Is there anyway to overcome this issue?
Try changing the max_allowed_packet setting to a larger value in the server.
Open "my.ini/cnf", located in your MySQL installation folder, and under [mysqld] section change "max_allowed_packet = 64M" and don't forget to restart the server. You can check the value by executing:
SHOW VARIABLES LIKE 'max_allowed_packet';
Refer: http://dev.mysql.com/doc/refman/5.0/en/gone-away.html