webrain / grunt-wordpress-deploy

A Grunt plugin to quickly deploy Wordpress websites.
MIT License
104 stars 37 forks source link

Error importing DB due to passwords #27

Open ghost opened 9 years ago

ghost commented 9 years ago

This was a problem with grunt-deployments, so was probably not fixed at the time you forked that project.

In at least some versions of MySQL, if you put the DB password on the command line with the -p argument, the first line of the resulting .sql file will be: "Warning: Using a password on the command line interface can be insecure."

When you then try to load this into another DB, it fails because of invalid SQ syntaxL.

A solution is to change the templates as follows:

mysqldump: "MYSQL_PWD=<%= pass %> mysqldump -h <%= host %> -u<%= user %> <%= database %>", mysql: "MYSQL_PWD=<%= pass %> mysql -h <%= host %> -u <%= user %> <%= database %>",

bulleric commented 9 years ago

+1

herbie4 commented 9 years ago

For me that did not work :( I had to use the following to get it to work (escaped double quotes on the -p )...

mysqldump: "mysqldump -h <%= host %> -u<%= user %> -p\"<%= pass %>\" <%= database %>", mysql: "mysql -h <%= host %> -u <%= user %> -p\"<%= pass %>\" <%= database %>",

gabrielwolf commented 9 years ago

The correction made it! Thanks.

neocamel commented 8 years ago

This solution did not work for me either. I get the error:

'MYSQL_PWD' is not recognized as an internal or external command, operable program or batch file.

Any ideas? I'm running cgywin on Windows 7.

herbie4 commented 8 years ago

Neocamel-> did you try the solution in my comment?

neocamel commented 8 years ago

Yes I did herbie, it didn't work for me either unfortunately.

What DID work for me was tomvdv's solution here: https://github.com/webrain/grunt-wordpress-deploy/pull/6

DrewDouglass commented 8 years ago

For anyone having similar DB issues, another thing to check is your DB passwords. Mine had a semicolon in the actual password which was causing issues with the dump. I guess these aren't always properly escaped, something to look for.