#20140502:副題つけた
前回はこちら
公式のチュートリアルに沿って作業していく。
ブログ用データベースのセットアップ
●データベースの作成とか
rootユーザで入って操作する。
mysql -u root -p
以下のSQLを実行。
# データベースの作成 create database cake default character set utf8; # データベース切り替え use cake; # ブログアプリケーションで使用するユーザを作成 create user akira identified by '******'; # 権限の付与 grant all on cake.* to 'akira'@'localhost' identified by '*****'; # postsテーブルの作成 create table posts ( id int unsigned auto_increment primary key, title varchar(50), body text, created datetime default null, modified datetime default null ); # テスト用の記事追加 insert into posts (title,body,created) values ('タイトル', 'これは、記事の本文です。', now()); insert into posts (title,body,created) values ('またタイトル', 'そこに本文が続きます。', now()); insert into posts (title,body,created) values ('タイトルの逆襲', 'こりゃ本当にわくわくする!うそ。', now());
#すげぇどうでもいいんだけど、「うそ。」って訳より「なんてね。」って訳のほうがしっくりこないかなこれ
database.php の接続情報を、上記で作成したデータベースに合わせて変更する。
TIPS:
database.php を編集したのに「Database connection "Mysql" is missing, or could not be created.」が出る場合
「PDOとpdo_mysqlがphp.iniで有効になっている必要があることを覚えておいてください。」という注釈に沿って、php.ini を修正しようと見てみたものの、そもそもコメントアウトにすら存在しない。。
http://stackoverflow.com/questions/13375061/installing-pdo-driver-on-mysql-linux-server
調べたら php5-mysql をインストールしないといけないらしい。以下のコマンド実行し、Apache と Mysql を再起動する。
sudo apt-get install php5-mysql
salt と seed の設定
とくに詰まる部分もないので省略。ジェネレータ使っても。
http://www.graviness.com/temp/pw_creator/
DebugKitの設定
git submodule add https://github.com/cakephp/debug_kit.git app/Plugin/DebugKit
The following path is ignored by one of your .gitignore files: app/Plugin/DebugKit Use -f if you really want to add it.
こんなエラーが出たら権限が足りないのでsudoで実行。
補足(20140501):
設定はここに書いてあるまま
https://github.com/cakephp/debug_kit#installation
これでトップページのエラーや警告が消える。