▼インストール
sudo port install mysql5 +server
▼my.cnf編集
sudo cp /opt/local/share/mysql5/mysql/my-medium.cnf /opt/local/etc/mysql5/my.cnf
InnoDBの設定をアンコメント
[mysqld]
default-character-set = utf8
default-storage-engine = innodb
skip-character-set-client-handshake
[mysql]
default-character-set = utf8
[mysqldump]
default-character-set = utf8
▼データベース初期化
sudo /opt/local/lib/mysql5/bin/mysql_install_db
sudo -u mysql mysql_install_db5
man mysql_install_db
you should either run mysql_install_db from the same account that will be used for running mysqld or run it as root and use the --user option to indicate the username that mysqld will run as.
▼デーモン登録
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
mysqladmin5 -u root password 'honyalala'
(再起動)
sudo launchctl stop org.macports.mysql5
▼パス
/opt/local/bin/以下のコマンドは全て/opt/local/lib/mysql5/binへのシンボリックリンクだけど,コマンド末にメジャーバージョン(5)がついているので(mysqladmin5など),/opt/local/lib/mysql5/binのほうを優先的にサーチするようにしておく.
▼CPANから足りないPerlモジュール追加
・DBD-mysql
テスト時に'root'@'localhost' (using password: NO)でアクセスしようとするため,パスワードは一時的に消しておく.
mysql> set password for root@localhost=password('');
Query OK, 0 rows affected (0.00 sec)
・Data-ShowTable
Leave a comment