webrain / grunt-wordpress-deploy

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

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax #18

Open craigmdennis opened 10 years ago

craigmdennis commented 10 years ago

When I run the task I get the following error:

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'bash: -c: line 0: syntax error near unexpected token `)'
bash: -c: line 0: `mysq' at line 1

Not sure if this is due to my system configuration or the plugin.

The error appears in the the staging .sql dumps but the grunt task says everything completes successfully. So it fails silently unless you add the flags --verbose --debug when calling the command.

The local db dump file shows correct SQL information.

craigmdennis commented 10 years ago

This is the code from inside the /staging/db_backup.sql Sensitive information has been removed.

bash: -c: line 0: syntax error near unexpected token `)'
bash: -c: line 0: `mysqldump -h{host} -u{user} -p{password} {database}'
nhaskins commented 10 years ago

Dunno if you solved this one, but I had the same trouble locally (OSX running MAMP)

The Grunt task wasn't able to use 'mysqldump' because it wasn't in my bash profile. If that's the case...

this is assuming MAMP is in the default location.

After adding the path line, save/exit/reset terminal. Now you have access to the command anywhere.. so that should put grunt in a position to execute properly.

craigmdennis commented 10 years ago

I use the built in apache which is already in my bash profile. Haven't solved this yet.

nhaskins commented 10 years ago

Hrm, does it get as far as generating a .sql file in your backup folder? If so, what does that file contain?

craigmdennis commented 10 years ago

I get the following error in terminal

Pulling database from 'Staging' into Local
>> Creating DUMP of remote database
>> Database DUMP succesfully exported to:
>> backups/staging/20140902/15-46-08/db_backup.sql
>> Adapt the database: set the correct urls for the destination in the database.
>> Creating DUMP of local database
>> Database DUMP succesfully exported to:
>> backups/local/20140902/15-46-08/db_backup.sql
>> Importing DUMP into local database
Warning: Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'bash: -c: line 0: syntax error near unexpected token `)'
bash: -c: line 0: `mysq' at line 1
>> Database imported succesfully

The local backup contains a full SQL dump but the remote backup contains

bash: -c: line 0: syntax error near unexpected token `)'
bash: -c: line 0: `mysqldump -h{host} -u{user} -p{password} {database}'

Where {host} {user} {password} and {database} are sensitive data.

nhaskins commented 10 years ago

my pull command output looks like this:

Pulling database from 'staging' into Local

Creating DUMP of remote database Database DUMP succesfully exported to: backups/staging/20140902/18-00-47/db_backup.sql Adapt the database: set the correct urls for the destination in the database. Creating DUMP of local database Database DUMP succesfully exported to: backups/local/20140902/18-00-47/db_backup.sql Importing DUMP into local database Database imported succesfully

Operations completed

Done, without errors.


What I notice different is yours has a line about 'Warning: Using a password on the command line..." then it throws an error. Can you try suppressing that warning? Maybe that's interfering with the rest of execution. Just a theory.

craigmdennis commented 10 years ago

How do I suppress it? Is #12 related?

nhaskins commented 10 years ago

Suppressing it, here's some info on that:

http://stackoverflow.com/questions/20751352/suppress-warning-messages-using-mysql-from-within-terminal-but-password-written

tomvdv commented 10 years ago

See https://github.com/webrain/grunt-wordpress-deploy/pull/6