Many of our users get error in establishing connection with mysql or some other configuration for mysql, so I decided to make this tutorial for Rails with Mysql Configuration.
Off-course to have good or little knowledge of Mysql or any database manager/software is better, but don’t worry if you doesn’t have any knowledge, we will give you a little knowledge in this tutorial, which will help you in Rails with Mysql Configuration.
Pr-Request for Rails with Mysql Configuration
I prefer Kali-Linux because it is good for developing too, it already have soo many developer tools like python, mysql etc. But if you are using any other O.S than you must install it manually.
- Install Mysql client and server from here.
- Install Mysql Workbench.
- Install libmysqlclient-dev using
sudo apt-get install libmysqlclient-dev
Some Basic Mysql Commands
Changing Mysql Root Password
Some time you need to change your mysql root password, in kali-linux by default there is no password.
- Enter into mysql shell using mysql -u root and then enter your old password.
- use database mysql using
- To show your old password use
SELECT PASSWORD FROM user WHERE User='root';
- Change Password using update command
UPDATE user SET Password=PASSWORD('1234') WHERE User='root';
- Flush all privileges using
Ruby recommends to create three databases, one for each development, testing and production environment.
According to convention their names should be:
Ruby already has command to sync your rails application with mysql, you can use the following command to sync your database with model.
Sometimes you need to create your database manually by using following command.
create database buffercode_development; grant all privileges on buffecode_development to 'root'@'localhost' identified by '123'; FLUSH PRIVILEGES;
Do same for other databases, or rake db:migrate will give you error.
Have something to add or still stuck somewhere ?? share it in comments .
Follow us on Facebook, Google Plus and Twitter. Previous Next