Consistency
Just spending the last 30 or so minutes on getting a simple script to dump a mysql database, I am reminded again that consistency for the trivial things is really nice to have. Consider what the mysql man page writes about using the password option:
-p|--password[=pwd]
Employ the specified password when connecting to the database
server. If a password is not supplied, it will be requested
interactively.
Ok, so there is an option that can be used as -p or —password and it can take an optional password to be given on the command line. That’s what I wanted, because it’s no problem to include the password in this particular script and including it makes it possible to use the script in a batch operation. So I did something like this:
mysql -u someone -p=something database
That resulted in an access denied message. Having had more trouble with access management, in particular in combination with the mysql-administrator application, I figured this would be related and I spent a lot of time there. Eventually I did find out what the problem was, the -p option actually takes its argument differently from the --password argument. So you can either do:
mysql -u someone -psomething database
or
mysql -u someone --password=something database
Why?