« しょこたんプラグイン(p) | メイン(m) | データベースのテーブル構成を考えてしまう »(n)

MySQLに繋ぐ設定を入れる

続いて、symfonyとデータベースを連携させる設定をしましょう。

プロジェクトルートのconfig 以下に設定ファイルが置いてあります。

まずはdatabases.ymlの変更。

all:
  propel:
    class:          sfPropelDatabase
    param:
      dsn:          mysql://root:@localhost/ls
      encoding:     utf8


続いて、O/RマッパPropelが使うpropel.iniの変更。

propel.database            = mysql
propel.database.createUrl  = mysql://root@localhost/
propel.database.url        = mysql://root@localhost/ls


最後にMySQLのデータベースを作成。

# mysqladmin create ls
# mysql -uroot ls
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 161861 to server version: 4.1.20
 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
mysql> 

これで準備完了です。



« しょこたんプラグイン | メイン | データベースのテーブル構成を考えてしまう »

Trackbacks

このエントリーのトラックバックURL:

Post a commnet

AMN sponsor rolls


著書

実践Web2.0 BOOK 人気ブロガー直伝! 一歩先行くWeb2.0的ワーキングスタイル
ムーバブル・タイププラグインディレクトリ―PROFESSIONAL NETWORK