Ruby On Rails

Dear all Rails Developers, i can not use the command “rails new app -d mysql” when i try to use this i got error.

please help me, thanks you.

Did you try install the mysql gem before run rails new command?

Try run “gem install mysql2” as suggested by the log.

This will show you what is the real problem.

when i use gem install mysql2. I got this error.

Result logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/mysql-2.9.1/gem_make.out

thanks you,

when i use gem install mysql2. I got this error.

Result logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/mysql-2.9.1/gem_make.out

thanks you,

Sorry to say that long long ago tried to install MySQL gem in Windows 7 and 8 and was not able to do it. If possible shift to linux.

You need to place mysql client ddl file. Refer here http://stackoverflow.com/questions/8162322/set-up-rails-to-find-the-default-location-of-libmysql-dll . I installed ROR on windows sometime backa nd resolved the issue by placing the dll file.

Dear Mr. Loganathan, After i copy dll file into ruby/bin then i start run “rails server”, localhost:3000 not working, it said mysql2::Error Access denied for user ‘root’@‘localhost’ (using password: NO)

please help me, thanks you.

Did you set the Mysql username & password in database.yml and can you able to login via mysql client directly?

Dear Mr. Loganathan

Could you tell me how to set username and password. Do i have to put it in Railsinstaller folder? if that how to do?

thanks for your help. veasna

You need to place the user name and password in database.yml.

database: dbname

adapter: mysql2

encoding: utf8

pool: 5

username: mysql-username

password: mysql-password

socket: /var/run/mysqld/mysqld.sock

Thanks again Mr. Loganathan but i am using window 8.

Whatever may be the OS, you need to configure the mysql credential in database.yml

One more thing, I have create application with this command “rails new app -d mysql”. when i start server i got error :

Mysql2::Error

Access denied for user ‘root’@‘localhost’ (using password: NO)

how to solve this error,

veasna

Maybe you should look the rails guides to resolve your problem[0]

TL:DR: You just need to update config/database.yml file with the correct authentication params for your MySQL server.

[0] http://guides.rubyonrails.org/v3.2.13/getting_started.html#configuring-a-mysql-database

Thanks Loganathan and Matt’s Now it work.

veasna