When using MySql with Rails, it runs properly when Rails and MySql are on the same computer, but running Rails from another computer which connects the MySql remotely get conection problem. Here is the solution.
- Modify the “/etc/mysql/my.cnf” file by commenting the content:
1 | skip-networking |
Then restart the MySql service by executing “service mysql stop; service mysql start”.
- Still cannot connection the MySql server, error message is “host ‘xxx’ is not allowed to connect to this MySQL server”, login the MySql server from the server it is and run the following command:
1 | mysql -u root -pPassw0rd |
Then it works.
P.S.
Some usefull statements:
1 | -- Create new account in MySQL: |