I'm quite stuck on installing it.
As a normal PHP guy, I first try install Rails, following this tutorial:
http://installrails.com/
And the next thing I want to learn about is how RoR works with MySQL, PhpMyadmin. So I tried to make it connect to XAMPP's MySQL but it did not work at all. I found out that, using mySQL in XAMPP package is not a common method, what I should do is to install MySQL as a single service onto my MAC. So I did following:
1. Install MYSQL with HomeBrew
Did you install HomeBrew, if not, please follow: https://coolestguidesontheplanet.com/installing-homebrew-on-os-x-el-capitan-10-11-package-manager-for-unix-apps/
Next, type this command to install MySQL to your machine:
$ brew install mysql
This will install mysql to your computer, if the installation is success, you could try start using mySQL with this command:
$ brew services start mysql
>>>>Remember, this will not work if you are running XAMPP's MySQL service because it is using the same port. You need to stop XAMPP's MySQL first
2. Install Ruby Mysql adapter
You need to tell Ruby to install mysql adapter, normally people using 1 of this 2 adapters:
$ gem install mysql
$ gem install mysql2
3. OK, now you can run your Rails app with MySQL
When coming here, someone might want to manage your prev-intalled MySQL with PhpMyAdmin, poor you, there is not so easy to do that because you will need to install PhpMyadmin, Apache, Php by yourself, single component separately. This will not be easy.
But you do not need to do that, because Ruby does not care about PhpMyAdmin, Apache or even PHP, it can run on it own sake. What you really need is a tool to manage your MySQL database, so, just find and download MySQL Workbench, a great tool, and much easy to use.
OK, remember that learning MySQL Workbench is easy too, just create schema(like create Database), and create table...
But in Linux, or another server, you will need to install MySQL and PHPMyAdmin by your self. So, I will write it in another writing, you might want to follow this on DigitalOcean: Install LAMPP and install PHPMyadmin
4. Config database for rails app
You will need to config file database.yml
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: root
password:
No need for socket in this case, but you can find your socket location at mySQLWorkbench
5. Run server
rails server
It is nice blog Thank you porovide important information and i am searching for same information to save my time Ruby on Rails Online Course
ReplyDelete