You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MySQL 5.7.8 Mysql::Error: SELECT command denied to user 'rails'@'localhost' for table 'session_variables': SHOW VARIABLES WHERE Variable_name = 'character_set_client' (ActiveRecord::StatementInvalid)
#21108
Closed
yahonda opened this issue
Aug 3, 2015
· 2 comments
$ mysql -urails
mysql> SHOW VARIABLES WHERE Variable_name = 'character_set_client' ;
ERROR 1142 (42000): SELECT command denied to user 'rails'@'localhost' for table 'session_variables'
mysql>
```ruby
$ rake test_mysql
/home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:317:in `query': Mysql::Error: SELECT command denied to user 'rails'@'localhost' for table 'session_variables': SHOW VARIABLES WHERE Variable_name = 'character_set_client' (ActiveRecord::StatementInvalid)
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:317:in `block in exec_without_stmt'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:509:in `block in log'
from /home/yahonda/git/rails/activesupport/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:503:in `log'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:316:in `exec_without_stmt'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:233:in `exec_query'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:225:in `client_encoding'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:460:in `set_field_encoding'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:575:in `block (2 levels) in columns'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:101:in `block in each_hash'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:99:in `each_hash'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:99:in `each_hash'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:574:in `each'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:574:in `map'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:574:in `block in columns'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:346:in `execute_and_free'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:573:in `columns'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/schema_cache.rb:51:in `columns'
from /home/yahonda/git/rails/activerecord/lib/active_record/connection_adapters/schema_cache.rb:57:in `columns_hash'
from /home/yahonda/git/rails/activerecord/lib/active_record/model_schema.rb:311:in `load_schema!'
from /home/yahonda/git/rails/activerecord/lib/active_record/attributes.rb:231:in `load_schema!'
from /home/yahonda/git/rails/activerecord/lib/active_record/attribute_decorators.rb:28:in `load_schema!'
from /home/yahonda/git/rails/activerecord/lib/active_record/model_schema.rb:306:in `load_schema'
from /home/yahonda/git/rails/activerecord/lib/active_record/model_schema.rb:234:in `attribute_types'
from /home/yahonda/git/rails/activerecord/lib/active_record/model_schema.rb:239:in `type_for_attribute'
from /home/yahonda/git/rails/activerecord/lib/active_record/table_metadata.rb:28:in `type'
from /home/yahonda/git/rails/activerecord/lib/active_record/relation/predicate_builder.rb:111:in `block in create_binds_for_hash'
from /home/yahonda/git/rails/activerecord/lib/active_record/relation/predicate_builder.rb:100:in `each'
from /home/yahonda/git/rails/activerecord/lib/active_record/relation/predicate_builder.rb:100:in `create_binds_for_hash'
from /home/yahonda/git/rails/activerecord/lib/active_record/relation/predicate_builder.rb:33:in `create_binds'
from /home/yahonda/git/rails/activerecord/lib/active_record/relation/where_clause_factory.rb:19:in `build'
from /home/yahonda/git/rails/activerecord/lib/active_record/relation/query_methods.rb:566:in `where!'
from /home/yahonda/git/rails/activerecord/lib/active_record/relation/query_methods.rb:556:in `where'
from /home/yahonda/git/rails/activerecord/lib/active_record/querying.rb:10:in `where'
from /home/yahonda/git/rails/activerecord/test/models/developer.rb:137:in `<class:CallableDeveloperCalledDavid>'
from /home/yahonda/git/rails/activerecord/test/models/developer.rb:135:in `<top (required)>'
from /home/yahonda/git/rails/activesupport/lib/active_support/dependencies.rb:302:in `require'
from /home/yahonda/git/rails/activesupport/lib/active_support/dependencies.rb:302:in `block in require'
from /home/yahonda/git/rails/activesupport/lib/active_support/dependencies.rb:268:in `load_dependency'
from /home/yahonda/git/rails/activesupport/lib/active_support/dependencies.rb:302:in `require'
from /home/yahonda/git/rails/activerecord/test/cases/relations_test.rb:9:in `<top (required)>'
from /home/yahonda/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/yahonda/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/yahonda/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/rake_test_loader.rb:15:in `block in <main>'
from /home/yahonda/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/rake_test_loader.rb:4:in `select'
from /home/yahonda/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/rake_test_loader.rb:4:in `<main>'
rake aborted!
Workaround is setting show_compatibility_56 = on in /etc/my.cnf and restart mysql server.
The text was updated successfully, but these errors were encountered:
This seems to be an issue with mysql 5.7.9 being the default in homebrew these days and rails migrations not working correctly, since it seems to be missing from 4-2-stable branch.
I ran into this problem after upgrading my homebrew MySQL. The problem here is that if you are upgrading from an older version of MySQL, some tables that the new MySQL uses will be out-of-date/non-existent. I was able to solve this by running:
Once #21107 workaround implemented,
rake test_mysql
shows this error when tested with MySQL 5.7.8It is easy to reproduce as follows.
show_compatibility_56 = on
in /etc/my.cnf and restart mysql server.The text was updated successfully, but these errors were encountered: