Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error importing DB due to passwords #27

Open
ghost opened this issue Jan 19, 2015 · 7 comments
Open

Error importing DB due to passwords #27

ghost opened this issue Jan 19, 2015 · 7 comments

Comments

@ghost
Copy link

ghost commented Jan 19, 2015

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
Copy link

+1

@herbie4
Copy link

herbie4 commented Aug 13, 2015

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
Copy link

The correction made it! Thanks.

@neocamel
Copy link

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
Copy link

herbie4 commented Dec 11, 2015

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

@neocamel
Copy link

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

What DID work for me was tomvdv's solution here:
#6

@DrewDouglass
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants