Home>

I am trying to deploy a rails app on AWS by referring to the following article.
https://qiita.com/naoki_mochizuki/items/5a1757d222806cbe0cd1
In the item "MySQL settings", I noticed that the DB was created with MySQL, and I am trying to recreate the database of the application.
I've tried the following methods, but I'm not sure where the problem is.
I'm sorry for the beginner's question, but could you please help me to deploy it safely?
Thank you.

Where the error occurred

$sudo service mysqld start
→ Redirecting to /bin/systemctl start mysqld.service
Failed to start mysqld.service: Unit not found.

Database.yml after trying to use mysql2 only for production environment referring to the article

default:&default
  adapter: sqlite3
  pool:<% = ENV.fetch ("RAILS_MAX_THREADS") {5}%>
  timeout: 5000
development:
<<: * default
  database: db/development.sqlite3
test: test:
<<: * default
  database: db/test.sqlite3
production:
  adapter: mysql2
  encoding: utf8
  pool:<% = ENV.fetch ("RAILS_MAX_THREADS") {5}%>
  database: zimotoai_app_production
  username: zimotoai_app
  password: password:
What I tried

I checked if MariaDB was uninstalled and MySQL was installed by referring to the following article.
After that, I was wondering if the article would solve the problem, so I decided to ask a question.
https://qiita.com/miriwo/items/e7afd5e1ae0de94f27c2

Postscript (How about the method of the following article?)

https://qiita.com/Seungbaek_Seo/items/ccef367521d94ebd0ed3
Production environment database creation
[ec2-user @ ip-172-31-23-189] $cd/var/www/app name/releases
[ec2-user @ ip-172-31-23-189] $ll
A folder with the name of the number representing the date is displayed Example: 20200218063515
cd bottom number # =>Example cd 20200218063515
[ec2-user @ ip-172-31-23-189] $rails db: create RAILS_ENV = production
=>Created database''
[ec2-user @ ip-172-31-23-189] $rails db: migrate RAILS_ENV = production

  • Answer # 1

    I was able to refer to the following article for starting mysql.
    https://qiita.com/naota7118/items/69a73e26374e24bbc538

    However, I couldn't execute rake db: create RAILS_ENV = production after that, so I asked a question.
    I would appreciate it if you could answer. Thank you.