LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 03:16 AM   #1
rahulvishwakarma
Member
 
Registered: Aug 2010
Posts: 138

Rep: Reputation: 2
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 03:20 AM.
 
Old 12-29-2018, 04:17 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

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

Rep: Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963Reputation: 7963
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-29-2018, 11:37 PM   #4
rahulvishwakarma
Member
 
Registered: Aug 2010
Posts: 138

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


Reply

Tags
mysql centos



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 01:11 PM
[SOLVED] fstab or export options needed to write to an nfs mounted ntfs export chief427 Linux - General 2 07-21-2011 07:07 AM
why should we export COMPTOP and what does !export do ? shaiva Linux - Newbie 5 11-03-2009 03:44 PM

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

All times are GMT -5. The time now is 10:32 PM.

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
Open Source Consulting | Domain Registration