開発準備
まずは、railsコマンドでアプリケーションの雛形作成。
$ rails coreserve
script/server で実行して、動作確認します。
$ cd coreserve $ script/server
http://localhost:3000/ にアクセスして、RailsのWelcomeページが表示されるのを確認。
次に、データベースを作成し、環境を設定します。
$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 to server version: 4.0.24_Debian-10sarge1-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create database coreserve_development ; Query OK, 1 row affected (0.00 sec) mysql> grant all on coreserve_development.* to coreserve@localhost identified by '**********' ; Query OK, 0 rows affected (0.00 sec)
# config/database.ymlの設定 development: adapter: mysql database: coreserve_development username: coreserve password: ******* host: localhost socket: /var/run/mysqld/mysqld.sock
debianのMySQLでは、最後の socket: /var/run/mysqld/mysqld.sockという記述が必要になるようです。