SQLでデータベースにアクセスしたいんですがあるはずのデータベースが見つかりません
railsでec_siteというデータベースを作ったんですが見当たりません。どうすればアクセスできますか?
環境はAWSのlinux
データベースはmariadb
言語はruby
フレームワークはrailsです
command
1[ec2-user@ip-10-0-0-235 ec_site]$ rails db:create RAILS_ENV=production 2Database 'ec_site' already exists 3[ec2-user@ip-10-0-0-235 ec_site]$ mysql -u root -p 4Enter password: 5Welcome to the MariaDB monitor. Commands end with ; or \g. 6Your MariaDB connection id is 12 7Server version: 5.5.68-MariaDB MariaDB Server 8 9Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. 10 11Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 12 13MariaDB [(none)]> SHOW DATABASES; 14+--------------------+ 15| Database | 16+--------------------+ 17| information_schema | 18| mysql | 19| performance_schema | 20+--------------------+ 213 rows in set (0.00 sec) 22MariaDB [(none)]> USE ec_site; 23ERROR 1049 (42000): Unknown database 'ec_site' 24
データベスの設定は以下の通りです
yml
1# SQLite. Versions 3.8.0 and up are supported. 2# gem install sqlite3 3# 4# Ensure the SQLite 3 gem is defined in your Gemfile 5# gem 'sqlite3' 6# 7default: &default 8 adapter: sqlite3 9 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 10 timeout: 5000 11 12development: 13 <<: *default 14 database: db/development.sqlite3 15 16# Warning: The database defined as "test" will be erased and 17# re-generated from your development database when you run "rake". 18# Do not set this db to the same as development or production. 19test: 20 <<: *default 21 database: db/test.sqlite3 22 23production: 24 <<: *default 25 #database: db/production.sqlite3 26 database: <%= Rails.application.credentials.db[:database] %> 27 username: <%= Rails.application.credentials.db[:username] %> 28 password: <%= Rails.application.credentials.db[:password] %> 29 socket: <%= Rails.application.credentials.db[:socket] %> 30
yml
1db: 2 database: ec_site 3 username: root 4 password: xxxxxx 5 socket: /var/lib/mysql/mysql.sock
ちなみにsqliteにもデータベースはありませんでした。
command
1[ec2-user@ip-10-0-0-235 ec_site]$ sqlite3 2SQLite version 3.7.17 2013-05-20 00:56:22 3Enter ".help" for instructions 4Enter SQL statements terminated with a ";" 5sqlite> .tables 6sqlite>
サーバーは一台しか作ってないはずです
回答3件
あなたの回答
tips
プレビュー