Rails6 (MySQL, Ubuntu environment, Cloud9)

1 Install rails gem

#For rails6
gem install rails -v 6.0.1
#rails5.In case of 2
gem install rails -v 5.2.1

2 MySQL settings (MySQL itself is installed by default in Cloud9)

#If you do not install this, you will get an error when installing mysql2 gem.
$ sudo apt-get install libmysqld-dev

3 Rails new


$ rails new appname -d mysql

4 Create a MySQL Account

$ sudo mysql -u root   #Login as root user
$ mysql> create user 'username' identified by 'password';  #User created
$ mysql> grant all on *.* to 'username';  #ALL authorization

#To confirm the created user, use the following command
$ mysql> select User,Host from mysql.user;

5 Edit config / database.yml

default: &default
  adapter: mysql2
  encoding: unicode
  pool: 5
  #Below, 3 lines added
  username: <username> #Same as the set MySQL Account
  password: <password> #Same as the set MySQL Account
  host: localhost
  
development:
  <<: *default
  database: appname_development #The appname should be the appname for rails new.
test:
  <<: *default
  database: appname_test #The appname should be the appname for rails new.

6 Create database with rails db: create & install webpacker

$ cd appname
$ rails db:create

#Not required for rails5
$ source <(curl -sL https://cdn.learnenough.com/yarn_install)
$ yarn install --check-files
$ rails webpacker:install

#config/enviroments/development.rb
config.hosts.clear

Recommended Posts

Rails6 (MySQL, Ubuntu environment, Cloud9)
Deploy heroku with Rails6 (Cloud9 + Ubuntu) + MySQL
[Rails / MySQL] Mac environment construction
Rails + MySQL environment construction with Docker
[Environment construction with Docker] Rails 6 & MySQL 8
Create Rails 6 + MySQL environment with Docker compose
[Docker] Development environment construction Rails6 / Ruby2.7 / MySQL8
Rails & React & Webpacker & MySQL Environment Construction Manual
Rails6 [API mode] + MySQL5.7 environment construction with Docker
[Flutter] Ubuntu 20.04 environment construction
Rails Docker environment construction
[Rails] Development with MySQL
Cloud9 (Rails) from Github
Build a Ruby on Rails development environment on AWS Cloud9
virtulbox + vagrant + Docker + nginx + puma + MySQL Rails environment construction
Regarding overcapacity when setting Rails tutorial environment in Cloud 9
Environment construction of Rails5 + MySQL8.0 + top-level volumes with docker-compose
Build Rails (API) x MySQL x Nuxt.js environment with Docker
Beginners use ubuntu in windows to prepare rails environment
Rails6 development environment construction [Mac]
Rails engineer environment construction ruby2.7.1
Rails environment construction Rails5.2.1 ruby2.5.1 Catalina
MySQL 5.7 (Docker) environment construction memo
[Environment variables] What are rails environment variables?
[Docker] Rails 5.2 environment construction with docker
Rails application development environment construction with Docker [Docker, Rails, Puma, Nginx, MySQL]
Laravel environment construction (Ubuntu 18.04 LTS)
Install Cloud9 on Raspberry pi 4 and set up Rails development environment
Rails 6 (API mode) + MySQL Docker environment creation by docker-compose (for Mac)
Procedure for building a Rails application development environment with Docker [Rails, MySQL, Docker]
Build an environment for Rails projects under Git management in Cloud9
How to build Rails + Vue + MySQL environment with Docker [2020/09 latest version]
Create a development environment for Ruby 3.0.0 and Rails 6.1.0 on Ubuntu 20.04.1 LTS
"Rails 6 x MySQL 8" Docker environment construction procedure for sharing with teams
[Windows] WSL2 + Ubuntu + Node.js environment construction
Rails new fails to install mysql
Let's create Ubuntu environment with vmware
Installing Ruby + Rails on Ubuntu 18.04 (rbenv)
Build environment with vue.js + rails + docker
Build Rails environment with Docker Compose
Ruby on Rails 6.0 environment construction memo
Build a XAMPP environment on Ubuntu
Rails on Docker environment construction procedure
[Today's stack # 1] Until on rails on cloud9
[Rails / MySQL] Database logical name setting
[Rails 6] Customize Bootstrap in Rails + Bootstrap 5.0.0-alpha environment
[Rails 6] MySQL 2 cannot be bundle install
Rails DB PostgreSQL changed to MySQL
Troublesome Rails environment construction flow [Windows 10]
[Environment construction] Uninstall rails from local
[Rails] AWS EC2 instance environment construction
How to distinguish ubuntu cloud image
Check MySQL logs in Docker environment
I built a rails environment with docker and mysql, but I got stuck
[Environment construction] Rails + MySQL + Docker (Beginners can also use it in 30 minutes!)
[Rails & Docker & MySQL environment construction] I started the container, but I can't find MySQL ...?
Environment construction of Ruby on Rails from 0 [Cloud9] (From Ruby version change to Rails installation)
Template: Build a Ruby / Rails development environment with a Docker container (Ubuntu version)
When building rails6 environment on Ubuntu, it gets stuck with bundle install
Complete roadmap for building environment up to Docker + rails6 + MySQL + bootstrap, jquery