Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
unable to create databases in Ruby
I had installed Ruby.
rvm install 2.6.6
I had Ruby which version was 3.0.0. I had removed it. Then, installed 2.6.6. When I try
bundle install
I got no error. When I tried following commands in Terminal. Then, I got some error.
rails db:create
rails db:schema:load
rails r db/scripts/create_tags_path_view.rb
rails db:migrate
Traceback (most recent call last):
4: from /home/istiak/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `<main>'
3: from /home/istiak/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `eval'
2: from /home/istiak/.rvm/gems/ruby-2.6.6/bin/rails:23:in `<main>'
1: from /home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0/rubygems.rb:284:in `find_spec_for_exe': can't find gem railties (>= 0.a) with executable rails (Gem::GemNotFoundException)
Traceback (most recent call last):
4: from /home/istiak/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `<main>'
3: from /home/istiak/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `eval'
2: from /home/istiak/.rvm/gems/ruby-2.6.6/bin/rails:23:in `<main>'
1: from /home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0/rubygems.rb:284:in `find_spec_for_exe': can't find gem railties (>= 0.a) with executable rails (Gem::GemNotFoundException)
Traceback (most recent call last):
4: from /home/istiak/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `<main>'
3: from /home/istiak/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `eval'
2: from /home/istiak/.rvm/gems/ruby-2.6.6/bin/rails:23:in `<main>'
1: from /home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0/rubygems.rb:284:in `find_spec_for_exe': can't find gem railties (>= 0.a) with executable rails (Gem::GemNotFoundException)
Traceback (most recent call last):
4: from /home/istiak/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `<main>'
3: from /home/istiak/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:22:in `eval'
2: from /home/istiak/.rvm/gems/ruby-2.6.6/bin/rails:23:in `<main>'
1: from /home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0/rubygems.rb:284:in `find_spec_for_exe': can't find gem railties (>= 0.a) with executable rails (Gem::GemNotFoundException)
Currently, I have the directory /home/istiak/.local/share/gem/ruby/3.0.0/
. Not 2.6.6. I had installed Ruby the way I wrote at first. Unfortunately, I couldn't access Ruby. That's why I had to install Ruby again.
sudo pacman -Sy ruby
I was using 2.6.6 following way.
/bin/bash --login
rvm use 2.6.6 --default
Here's the process
When I tried
bundle exec rails db:create
I got some error.
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:create
Access denied for user 'root'@'localhost'
Couldn't create 'qpixel_dev' database. Please check your configuration.
rails aborted!
Mysql2::Error: Access denied for user 'root'@'localhost'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `connect'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `initialize'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:22:in `new'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:22:in `mysql2_connection'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:830:in `new_connection'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:874:in `checkout_new_connection'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:853:in `try_to_checkout_new_connection'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:814:in `acquire_connection'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:538:in `checkout'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:382:in `connection'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1033:in `retrieve_connection'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_handling.rb:118:in `retrieve_connection'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/connection_handling.rb:90:in `connection'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/tasks/mysql_database_tasks.rb:6:in `connection'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/tasks/mysql_database_tasks.rb:14:in `create'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/tasks/database_tasks.rb:119:in `create'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/tasks/database_tasks.rb:139:in `block in create_current'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/tasks/database_tasks.rb:316:in `block in each_current_configuration'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/tasks/database_tasks.rb:313:in `each'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/tasks/database_tasks.rb:313:in `each_current_configuration'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/tasks/database_tasks.rb:138:in `create_current'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/activerecord-5.2.6/lib/active_record/railties/databases.rake:29:in `block (2 levels) in <top (required)>'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `block in execute'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `each'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:281:in `execute'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:199:in `invoke_with_call_chain'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/task.rb:188:in `invoke'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:160:in `invoke_task'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `each'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:116:in `block in top_level'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:125:in `run_with_threads'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:110:in `top_level'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/railties-5.2.6/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/rake-13.0.3/lib/rake/application.rb:186:in `standard_exception_handling'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/railties-5.2.6/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/railties-5.2.6/lib/rails/command.rb:48:in `invoke'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/railties-5.2.6/lib/rails/commands.rb:18:in `<top (required)>'
/home/istiak/qpixel/bin/rails:9:in `require'
/home/istiak/qpixel/bin/rails:9:in `<top (required)>'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
/home/istiak/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
/home/istiak/qpixel/bin/spring:13:in `require'
/home/istiak/qpixel/bin/spring:13:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:create
When I tried to Setting up the database
mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.5.10-MariaDB Arch Linux
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE USER qpixel@localhost IDENTIFIED BY '123456';
ERROR 1396 (HY000): Operation CREATE USER failed for 'qpixel'@'localhost'
MariaDB [(none)]> GRANT ALL ON qpixel_dev.* TO qpixel@localhost;
Query OK, 0 rows affected (0.014 sec)
MariaDB [(none)]> GRANT ALL ON qpixel_test.* TO qpixel@localhost;
Query OK, 0 rows affected (0.007 sec)
MariaDB [(none)]> GRANT ALL ON qpixel.* TO qpixel@localhost;
Query OK, 0 rows affected (0.018 sec)
I am actually unable to create user for qpixel. But, I could create user any other way. Why? How to create user for qpixel?
[istiak-4291zfv config]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.5.10-MariaDB Arch Linux
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE USER Emma@localhost IDENTIFIED BY '123';
Query OK, 0 rows affected (0.057 sec)
MariaDB [(none)]> CREATE USER qpixel@localhost IDENTIFIED BY 'root';
ERROR 1396 (HY000): Operation CREATE USER failed for 'qpixel'@'localhost'
MariaDB [(none)]> CREATE USER qpixel@localhost IDENTIFIED BY '123';
ERROR 1396 (HY000): Operation CREATE USER failed for 'qpixel'@'localhost'
2 comment threads