Tutorial setting eviroment rvm, ruby, ruby on rails, mysql, connect with mysql workbench trong ubuntu | Trần Hữu Thắng


  • Step 1: sudo apt-get update

  • Step 2: sudo apt install gnupg2

  • Step 3: sudo apt install curl

  • Step 4: curl -sSL https://rvm.io/mpapis.asc | gpg --import -

  • Step 5: curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -

  • Step 6: curl -sSL https://get.rvm.io | bash -s stable && source ~/.bashrc

  • Step 7: rvm --version


  • Step 8: rvm install ruby

  • Step 9: rvm install 2.7.2

  • Step 10: sudo apt install ruby && check ruby --version


  • Step 11: sudo apt install ruby-railties & check rails -v

  • Step 12: /bin/bash --login && rvm use 2.7.2 --default

  • Step 13: install rails version , i install rails 6.1 gem install rails --version=6.1.4 && rails -v


  • Step 14: sudo apt install mysql-server

  • Step 15: sudo mysql_secure_installation Come here, you set a password and keep saying yes

  • Step 16: sudo mysql -u root -p Press enter ALTER USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'welcome123';

  • Step 17: ALTER USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'welcome123'; in case error Your password does not satisfy the current policy requirements then enter SHOW VARIABLES LIKE 'validate_password%';

enter 3 line this code

SET GLOBAL validate_password_policy=LOW;
SET GLOBAL validate_password.length = 9; 
SET GLOBAL validate_password.number_count = 0;

If there is no error, continue This is you set your mysql password, to connect the database

  • Step 19 : sudo mysql -u root -p Result

That's it, just to be sure, try to enter it wrong and see if it gives you this error, Result


Install mysql workbench


  • Step 21: connect mysql workbech Enter your password mysql

result :

Done 😄

All Rights Reserved

Let's register a Viblo Account to get more interesting posts.