LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 12-29-2018, 04:16 AM   #1
rahulvishwakarma
Member
 
Registered: Aug 2010
Posts: 56

Rep: Reputation: 0
export in mysql problem


dear friends' i've centos6.4 as both server and client. i am trying to export database "inventory"
i tried following commands but failed :-
Code:
mysqldump -u [user] -p [db_name] | gzip > [filename_to_compress.sql.gz] 

For Import:

gunzip < [compressed_filename.sql.gz]  | mysql -u [user] -p[password] [databasename] 

Note: There is no space between the keyword '-p' and your password
giving followeing output:-
Code:
mysql> mysqldump --databases --user=root -p inventory > /software/inv.sql
    -> ;
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 'mysqldump --databases --user=root -p inventory > /software/inv.sql' at line 1
please tell me how to expert and imoprt databases

Last edited by rahulvishwakarma; 12-29-2018 at 04:20 AM.
 
Old 12-29-2018, 05:17 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,354

Rep: Reputation: 1710Reputation: 1710Reputation: 1710Reputation: 1710Reputation: 1710Reputation: 1710Reputation: 1710Reputation: 1710Reputation: 1710Reputation: 1710Reputation: 1710
Hi,

The correct command to dump a database is:
Code:
mysqldump --user=root -p inventory > /software/inv.sql
 
Old 12-29-2018, 09:43 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 20,930

Rep: Reputation: 5215Reputation: 5215Reputation: 5215Reputation: 5215Reputation: 5215Reputation: 5215Reputation: 5215Reputation: 5215Reputation: 5215Reputation: 5215Reputation: 5215
Quote:
Originally Posted by rahulvishwakarma View Post
dear friends' i've centos6.4 as both server and client. i am trying to export database "inventory"
i tried following commands but failed :-
Code:
mysqldump -u [user] -p [db_name] | gzip > [filename_to_compress.sql.gz] 

For Import:

gunzip < [compressed_filename.sql.gz]  | mysql -u [user] -p[password] [databasename] 

Note: There is no space between the keyword '-p' and your password
giving followeing output:-
Code:
mysql> mysqldump --databases --user=root -p inventory > /software/inv.sql
    -> ;
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 'mysqldump --databases --user=root -p inventory > /software/inv.sql' at line 1
please tell me how to expert and imoprt databases
Since you say you've 'found' these commands (ostensibly on other websites/forums/documentation), you really then need to read the documentation on their use. There is a HUGE volume of sites that can tell you how to export a MySQL database. Read the "Question Guidelines" link in my posting signature, and do basic research first before posting.

You're typing the mysqldump command in to the MySQL console...that will not work. You do it on the command-line. It's even telling you the syntax is wrong in the error...can't get more clear than that. Read the man page on the mysqldump command, and *THINK* about what you're typing in. Do you require a root password for MySQL access? If not, why are you putting the -p (for a PASSWORD???) Read up on those other options as well, to see what you need and don't need.

You've been asking about MySQL for FOUR YEARS now....have you made no progress at all???
 
Old 12-30-2018, 12:37 AM   #4
rahulvishwakarma
Member
 
Registered: Aug 2010
Posts: 56

Original Poster
Rep: Reputation: 0
thanks a lot this worked . i run this command in command prompt and it worked.
 
  


Reply

Tags
mysql centos


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] bash: export: `=': not a valid identifier - bash: export: `0': not a valid identifier PClOStinspace Linux - General 4 01-24-2014 02:11 PM
[SOLVED] fstab or export options needed to write to an nfs mounted ntfs export chief427 Linux - General 2 07-21-2011 08:07 AM
why should we export COMPTOP and what does !export do ? shaiva Linux - Newbie 5 11-03-2009 04:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 05:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration