LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-17-2011, 01:47 PM   #1
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Rep: Reputation: 33
mysqldump keeps asking mysql password


Hello,

I want to take a backup of a mysql-DB in a bash-script with mysqldump, but mysqldump always asks password so automatism is not possible :
Code:
[root@server ~]# mysqldump -u root -p mypass | gzip -9 > backup_db.sql.gz
Enter password:
How come ?
 
Old 08-17-2011, 01:57 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Hi, please check the mysqldump(1) manpages:
Code:
         --password[=password], -p[password]

           The password to use when connecting to the server. If you use the
           short option form (-p), you cannot have a space between the option
           and the password. If you omit the password value following the
           --password or -p option on the command line, mysqldump prompts for
           one.
You're using the short option form, so...
 
Old 08-17-2011, 04:48 PM   #3
freevps
LQ Newbie
 
Registered: Aug 2011
Posts: 1

Rep: Reputation: Disabled
false:
# mysqldump -u root -p mypass | gzip -9 > backup_db.sql.gz
true:
# mysqldump -u root -pmypass | gzip -9 > backup_db.sql.gz
 
Old 08-18-2011, 02:00 AM   #4
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,027

Rep: Reputation: 69
Classic mysql mistake. Remember -p doesn't like spaces so -ppassword. You can do the same for the rest.
Code:
mysqldump -uroot -pmypass
 
Old 08-18-2011, 05:29 AM   #5
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Original Poster
Rep: Reputation: 33
Thank you !
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
copying /var/lib/mysql instead of mysqldump dinakumar12 Linux - Server 19 02-10-2011 04:01 AM
[Mysql] mysqldump doesn't work when restoring data Kunsheng Linux - Software 1 09-26-2009 12:24 AM
Mysql backup: mysqldump problem sshd.root Linux - Server 2 02-29-2008 11:12 AM
MySQL :: Permission required to run mysqldump Swakoo Linux - General 4 01-22-2007 10:58 PM
MySQL:: backup entire databse but with selected tables structure only using mysqldump Swakoo Linux - General 1 11-07-2006 03:38 PM


All times are GMT -5. The time now is 06:35 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