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

You have an error in your SQL syntax; #428

Open
overflowsecurity opened this Issue Apr 7, 2016 · 7 comments

Comments

Projects
None yet
7 participants
@overflowsecurity
Copy link

overflowsecurity commented Apr 7, 2016

Hi all - when running rake snorby:setup I get the following errors. The script creates the DB but then errors out and no tables are created. I have been following the instructions on install and can not seem to figure this out. I am runnng FreeBSD. Any help is greatly appreciated!

`
root@snort01:~/snorby # bundle exec rake snorby:setup
Jammit Warning: Asset compression disabled -- Java unavailable.
syck has been removed, psych is used instead
No time_zone specified in snorby_config.yml; detected time_zone: America/New_York
80901a42ad1ac11f15f334517a86ebb034cd1b6f9cfd3e98e7c05b8cbb7b8d7b75bc8b336400c559e1eae3f26e40c9b10ef5187ca4a5b4c922ef444491efe6126
mysql: [Warning] Using a password on the command line interface can be insecure.
[datamapper] Created database 'snorby'
rake aborted!
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 ''' at line 1

Tasks: TOP => db:autoupgrade
(See full trace by running task with --trace)
root@snort01:~/snorby #
`

@m2fd

This comment has been minimized.

Copy link

m2fd commented May 1, 2016

Hi,

I have the same problem. I'm using ubuntu 16.04 with rails 3.2.22, ruby 2.3.0p0 (2015-12-25) [x86_64-linux-gnu], mysql Ver 14.14 Distrib 5.7.12, for Linux (x86_64) using EditLine wrapper. From what, I understood, rake db:autoupgrade seems to have some problem. I don't know much more .... I guess the problem is beyond the scope of this project...

development.log:
SQL (0.305ms) SET SESSION sql_mode = 'ANSI,NO_BACKSLASH_ESCAPES,NO_DIR_IN_CREATE,NO_ENGINE_SUBSTITUTION,NO_UNSIGNED_SUBTRACTION,TRADITIONAL'
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 ''' at line 1 (code: 1064, sql state: 42000, query: SHOW TABLES LIKE ', uri: mysql:root@localhostsnorby?database=snorby&path=snorby&adapter=mysql&username=user&password=passwd&host=localhost)

trace:

bundle exec rake snorby:setup --trace --verbose
Jammit Warning: Asset compression disabled -- Java unavailable.
No time_zone specified in snorby_config.yml; detected time_zone: Europe/Paris
** Invoke snorby:setup (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute snorby:setup
** Invoke secret (first_time)
** Execute secret
XX
** Invoke db:create (first_time)
** Invoke environment
** Execute db:create
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1007 (HY000) at line 1: Can't create database 'snorby'; database exists
** Invoke snorby:update (first_time)
** Invoke environment
** Execute snorby:update
** Invoke db:autoupgrade (first_time)
** Invoke environment
** Execute db:autoupgrade
rake aborted!
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 ''' at line 1
/var/lib/gems/2.3.0/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:34:in execute_reader' /var/lib/gems/2.3.0/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:34:inblock in select'
/var/lib/gems/2.3.0/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:276:in with_connection' /var/lib/gems/2.3.0/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:33:inselect'
/var/lib/gems/2.3.0/gems/dm-migrations-1.2.0/lib/dm-migrations/adapters/dm-mysql-adapter.rb:22:in storage_exists?' /var/lib/gems/2.3.0/gems/dm-migrations-1.2.0/lib/dm-migrations/adapters/dm-do-adapter.rb:90:increate_model_storage'
/var/lib/gems/2.3.0/gems/dm-migrations-1.2.0/lib/dm-migrations/adapters/dm-do-adapter.rb:57:in upgrade_model_storage' /var/lib/gems/2.3.0/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:73:inupgrade_model_storage'
/var/lib/gems/2.3.0/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:145:in auto_upgrade!' /var/lib/gems/2.3.0/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:47:inblock in repository_execute'
/var/lib/gems/2.3.0/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:46:in each' /var/lib/gems/2.3.0/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:46:inrepository_execute'
/var/lib/gems/2.3.0/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:27:in auto_upgrade!' /var/lib/gems/2.3.0/gems/dm-rails-1.2.1/lib/dm-rails/railties/database.rake:47:inblock (3 levels) in <top (required)>'
/var/lib/gems/2.3.0/gems/dm-rails-1.2.1/lib/dm-rails/railties/database.rake:46:in each' /var/lib/gems/2.3.0/gems/dm-rails-1.2.1/lib/dm-rails/railties/database.rake:46:inblock (2 levels) in <top (required)>'
/var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:205:in block in execute' /var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:200:ineach'
/var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:200:in execute' /var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:158:inblock in invoke_with_call_chain'
/usr/lib/ruby/2.3.0/monitor.rb:214:in mon_synchronize' /var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:151:ininvoke_with_call_chain'
/var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:144:in invoke' /home/user/Documents/snorby/snorby/lib/tasks/snorby.rake:40:inblock (2 levels) in <top (required)>'
/var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:205:in block in execute' /var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:200:ineach'
/var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:200:in execute' /var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:158:inblock in invoke_with_call_chain'
/usr/lib/ruby/2.3.0/monitor.rb:214:in mon_synchronize' /var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:151:ininvoke_with_call_chain'
/var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:144:in invoke' /home/user/Documents/snorby/snorby/lib/tasks/snorby.rake:33:inblock (2 levels) in <top (required)>'
/var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:205:in block in execute' /var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:200:ineach'
/var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:200:in execute' /var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:158:inblock in invoke_with_call_chain'
/usr/lib/ruby/2.3.0/monitor.rb:214:in mon_synchronize' /var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:151:ininvoke_with_call_chain'
/var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/task.rb:144:in invoke' /var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/application.rb:112:ininvoke_task'
/var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/application.rb:90:in block (2 levels) in top_level' /var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/application.rb:90:ineach'
/var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/application.rb:90:in block in top_level' /var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/application.rb:129:instandard_exception_handling'
/var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/application.rb:84:in top_level' /var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/application.rb:62:inblock in run'
/var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/application.rb:129:in standard_exception_handling' /var/lib/gems/2.3.0/gems/rake-0.9.2/lib/rake/application.rb:59:inrun'
/var/lib/gems/2.3.0/gems/rake-0.9.2/bin/rake:32:in <top (required)>' /usr/local/bin/rake:23:inload'
/usr/local/bin/rake:23:in `

'

@marcsaegesser

This comment has been minimized.

Copy link

marcsaegesser commented May 2, 2016

I'm having the same problem and am also using Xenial (Ubuntu 16.04).

mysql --version
mysql Ver 14.14 Distrib 5.7.12, for Linux (x86_64) using EditLine wrapper

@Rossmairm

This comment has been minimized.

Copy link
Contributor

Rossmairm commented May 2, 2016

I am getting the exact same error, I am also running 'mysql Ver 14.14 Distrib 5.7.12, for Linux (x86_64) using EditLine wrapper' on Ubuntu 16.04

Rossmairm added a commit to Rossmairm/snorby that referenced this issue May 3, 2016

@Rossmairm

This comment has been minimized.

Copy link
Contributor

Rossmairm commented May 3, 2016

Due to changes in mysql 5.7, the do_mysql 0.10.16 gem no longer works. The bug was reported and fixed here: datamapper/do#88

To fix edit your Gemfile.lock

' - do_mysql (> 0.10.6)'
'+ do_mysql (
> 0.10.17)'

'- do_mysql (0.10.16)'
'+ do_mysql (0.10.17) '

I have submitted a pull request

@dustinmhorvath

This comment has been minimized.

Copy link

dustinmhorvath commented Jun 23, 2016

Confirmed that this resolved the issue for me in the script I've been constructing. Just testing today on Xenial. Hopefully this gets rolled up into master soon so I don't need my exception handling.

@crlshn

This comment has been minimized.

Copy link

crlshn commented Aug 29, 2016

thanks mate... works, after edit the Gemfile.lock
bundle install
to upgrade the modules. and the
bundle exec rake snorby:setup

gehrhorn added a commit that referenced this issue Aug 29, 2016

Merge pull request #432 from Rossmairm/master
Fixes issue #428: do_mysql update to work with mysql 5.7
@richardlaborde

This comment has been minimized.

Copy link

richardlaborde commented Sep 11, 2016

I had to run the gem install manually:
gem install do_mysql -v 0.10.17

Otherwise, this looks like it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment