LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 12:47 PM   #1
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 690

Rep: Reputation: 34
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, 12: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, 03: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, 01:00 AM   #4
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,052

Rep: Reputation: 70
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, 04:29 AM   #5
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 690

Original Poster
Rep: Reputation: 34
Thank you !
 
  


Reply



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 03:01 AM
[Mysql] mysqldump doesn't work when restoring data Kunsheng Linux - Software 1 09-25-2009 11:24 PM
Mysql backup: mysqldump problem sshd.root Linux - Server 2 02-29-2008 10:12 AM
MySQL :: Permission required to run mysqldump Swakoo Linux - General 4 01-22-2007 09:58 PM
MySQL:: backup entire databse but with selected tables structure only using mysqldump Swakoo Linux - General 1 11-07-2006 02:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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