May 30, 2004

MovableType 2.64 の Berekeley DB から SQL への移行

NetBSD 2.0E(current) にアップデートしたら、Berkeley DBのせいか、MovableTypeとすりあわせが悪くなった感じがするので、覚悟を決めて MySQLに移行しました。

やることは、それほど手間ではなくて、

  • MySQL をセットアップする
  • MovableType 用のDBを作る
  • 作ったDBにアカウントを足す
  • MT2.x の Upgrade パッケージに入っている mt-db2sql.cgi を実行する

これだけです。最初のDBのセットアップは、やったことがない人は一苦労かもしれませんが、NetBSDの pkg 使う限りでは、以下の手順で mysql4-server, p5-DBD-mysql を入れればOK。

 # cd /usr/pkgsrc/mysql4-server
 # make install
 # make clean
 # cd /usr/pkgsrc/p5-DBD-mysql
 # make install
 # make clean

 # cp /usr/pkg/etc/rc.d/mysqld /etc/rc.d
 # vi /etc/rc.conf				-> mysqld=YES を追加
 # reboot					-> mysqld をあげられればOK

 # mysqladmin -u root password 'root-pass'	-> root password 設定

ここまでで、設定は終了。 続けて、MovableType用のDBを作り、アカウントを作成
 # mysqladmin -u root -p create blogdb
 # mysql -u root -p
 Enter password: 
 Welcome to the MySQL monitor.  Commands end with ; or \g.
 Your MySQL connection id is 28 to server version: 4.0.18

 Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

 mysql> grant select,insert,update,delete,create on blogdb.* to bloguser@localhost identified by 'パスワード';
 Query OK, 0 rows affected (0.01 sec)

 mysql> Bye

最後に、mt-db2sql.cgi を実行

  • mt-db2sql.cgi を、MovableType 2.6xの upgrade 版のアーカイブから取 り出し、mt.cgi と同じディレクトリに置く。(当然、mt.cgi とモードは合わせる)
  • mt-db-pass.cgi に、DBパスワードを入れる(注意: パスワードだけ。ほ かに余計なものは入れない
  • mt.cfg で、ObjectDriver, Database, DBUserを設定する。ここでは、DBはmysql、DB名はblogdb、DBユーザ名は bloguser としているので、以下のように設定する。
    ObjectDriver DBI::mysql
    Database blogdb
    DBUser bloguser
    
  • mt-db2sql.cgiをBrowser経由で実行します

これで終了なのですが、私の場合、テンプレートを外部ファイルとリンクしていて、このファイルを読めないといってエラーが出てしまったので、外部ファイルリンクを予め全部取り除いてから、もう一度 mt-db2sql.cgi を実行したら、うまくいきました。

多少参考になるのは、以下のリンクです。

Lolipop の移行の説明
http://lolipop.jp/?mode=manual&state1=other&state2=movable2&PHPSESSID=f9006d285fd4f2fbe7645690fa866bfc

MovableTypeのMySQL対応の顛末
http://salvageship.dropcontrol.com/2003/07/movabletypemysq.html

MovableTypeのMySQL対応の顛末その2
http://salvageship.dropcontrol.com/2003/07/movabletypemysq_1.html

Salvageship での説明では、うまくいっていなかったようですが、2.6以降でやるなら、うまくいくのではないかという感じですね。

ちなみに、私がはまったのは、上記に加えて、upgrade版のMTが入手できなかったことです。(SixApartは、もう新しいの配ってない)なんとか探しました。。

Posted by shigeya at 07:44 PM | TrackBack (0)
Comment

Wonderful work. I enjoyed read your site a lot.

casino

Posted by: casino : August 26, 2004 06:26 PM

No plain fanfold paper could hold that fractal Puff --
He grew so fast no plotting pack could shrink him far enough.
Compiles and simulations grew so quickly tame
And swapped out all their data space when Puff pushed his stack frame.
CHORUS:
Puff the fractal dragon was written in C,
And frolicked while processes switched in mainframe memory.
Puff the fractal dragon was written in C,
And frolicked while processes switched in mainframe memory.
Puff, he grew so quickly, while others moved like snails
And mini-Puffs would perch themselves on his gigantic tail.
All the student hackers loved that fractal Puff
But DCS did not like Puff, and finally said, Enough!
(chorus)
Puff used more resources than DCS could spare.
The operator killed Puff's job -- he didn't seem to care.
A gloom fell on the hackers; it seemed to be the end,
But Puff trapped the exception, and grew from naught again!
(chorus)
Home Equity Loan Rate http://www.home-equity-loan-x.com

Posted by: Home Equity Loan Rate : November 17, 2004 12:21 AM
Post a comment









名前、アドレスを登録しますか?