Export DB using MySQL Console error in syntax - mysql

I'm using WAMP Server in a local PC.
I'm trying to export a big database using MySQL console but its just not working. I always get a syntax error 1064
The queries I tried:
mysqldump -u USER -p DATABASE > backup.sql;
mysqldump -u USER -pPASSWORD DATABASE > backup.sql;
(of course I'm replacing USER, PASSWORD and DATABASE with real values)
I also tried some more similar queries but I'm getting the same syntax error every time.
Please help!!!!!

You should type this in your command prompt not in MySQL console.
mysqldump is an application not MySQL command.

Related

Importing a sql file to mysql on an ubuntu server failing

I'm trying to import a sql file that is on the server using the following command in the terminal
mysql -u NAME -p DBNAME < path/to/FILE.sql
when i do that it asks for the password, after inputting the password nothing happens. I check the database and no tables have been added.
Note:
DBNAME is created in the mysql database.
I have also tried the following syntax in mysql and also that didn't work
mysql> source PATH/TO/FILE.sql
Please Help :D
The sql file was corrupt, all i had to do was delete it and upload it once again. thanks #CBroe
Hello you can trying with
Create the database for import the tables:
mysql -u root -p
create database database_name;
exit
mysql -u user -p databasename < databasename.sql

data export error mysql workbench 6.3

I want to export the whole database using workbench. I keep getting the following error message. I used server>data export option in workbench.
This is a known bug in MySQL Workbench 6.3.5. Your options are to either (A) wait for an upcoming Workbench version to fix it, or (B) change your mysqldump binary (under User Preferences) to a different non-bundled mysqldump binary, likely one from MySQL Server 5.6.
You can easily dump the whole database from the command line:
mysqldump -u <db_username> -p -h <db_host> db_name > database_dump.sql

How do i import a Database Dump .sql file via Console

I'm Using WAMP Stack on Windows 7 Ultimate 64bit
I have a Database Dump (test-mysql.sql) file, which, for simplicity, i've located at
C:/test-mysql.sql
Using MYSQL CONSOLE (not Windows cmd.exe)
I'm trying to simply import this file into MySQL, assuming this file will be imported as it's own database, have not yet created a database for it.If a database name needs to be specified, i would like it to be tested.
I've tried the following combinations of code :
-u Martin.Kuliza -p test < test.mysql.sql;
mysql -u Martin.Kuliza -p test < test-mysql.sql;
mysql -p -u Martin.Kuliza test < test-mysql.sql;
mysql -p -uMartin.Kuliza test < test-mysql.sql;
I Keep Getting Error 1064 (42000)
My Understanding is that the syntax is as follows,
after the prompt mysql>
I'm supposed to use the following syntax,
mysql -p -u{Username} {Database Name} < {Dump File Name.extension}
Why is this not working..
thanks ahead of time
Martin, you need to provide absolute path in window something like this
C:\wamp\bin\mysql\mysql5.5.24\bin\mysql.exe -u root -p db_name < C:/test-mysql.sql

importing table using mysql console on localhosted WAMP

this is what I use in MySQL console (WAMP) (no password, as it is local)
mysql> mysql -u root -p dbase < table.sql
or this
mysql> mysql -u root -p dbase < C:\path\to\table.sql
this is what I get:
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
-u root -p dbase < table.sql' at line 1
what may cause this problem?
The command you're using is meant to be run outside of the mysql shell. If you just exit out of the mysql shell and enter the same command, it should work.
OK - step by step - since, if someone is not used to it, any omission may get that "someone" lost.
remote nix server:
connect to mysql cli (command line interface) using e.g. Putty - type in: mysql -u user -pyourpassword
now you are connected to MySQL server and you can use e.g. LOAD INFILE command etc.
"exit" gets you back to "-bash" so you can use, e.g. database importing - just type: mysql -u root -p hmvc < table.sql
local WAMP - (setup: WAMP2.2 - Apache2.2.21 - MySQL5.5.20)
case I: using Windows "command prompt"
change directory to the one, where your mysql resides within WAMP root, e.g.:
C:\wamp\bin\mysql\mysql5.5.20\bin
connect to mysql cli:
mysql -u user -pyourpassword
now you are in, so you can use e.g. LOAD INFILE command etc.
"exit" gets you back to "C:\wamp\bin\mysql\mysql5.5.20\bin>" so you can use, e.g. database importing:
mysql -u root -p hmvc < table.sql
etc.
case 2: using mysql cli directly
WAMP offers a link to it in its tray icon command collection
link is called: MySQL console
it calls mysql server diretly by invoking C:\wamp\bin\mysql\mysql5.5.20\bin\mysql.exe
you can use all MySQL commands right away, like e.g. LOAD INFILE
you cannot import/dump database using this console
if you try to exit, MySQL console will do just that - it will exit (window gets closed)
I hope it will you some time.

Taking MySQL database Back up Using Zoc terminal (Linux server)

My Application uses Mysql database and is hosted on linux server, and I am using Zoc terminal from my window system to connect to mysql Db. I am trying to backup mysql database using mysql dump through Zoc terminal, however its says: ERROR 1064 (42000): You have an error in your SQL syntax.
Anyone, who could help me..
Any help would be highly appreciated.
Not familiar with Zoc terminal, however dumping a database is fairly easy through command line.
mysqldump -u user -p database > database.sql
There is also the --all-databases trigger as well.