MacPorts で MySQL 5 をインストールする
今まではおうちのファイルサーバ上にある MySQL 使ってたんですが、Mac上でスタンドアローンに使えるDBが欲しくなったのでさくっとインストール。
Debian の ant もそうですが、MacPorts も相当いい感じのバージョン管理システムだなぁ (*´¬`)
MacPorts にある MySQL を検索
$ port search mysql gauche-dbd-mysql databases/gauche-dbd-mysql 0.2.1 Gauche database driver for MySQL mysql3 databases/mysql3 3.23.58 Multithreaded SQL database server mysql4 databases/mysql4 4.1.22 Multithreaded SQL database server mysql5 databases/mysql5 5.0.67 Multithreaded SQL database server mysql5-devel databases/mysql5-devel 5.1.28-rc Multithreaded SQL database server mysqltcl databases/mysqltcl 3.02 Simple API for Mysql-Database and Tcl scripting language. mysqlxx databases/mysqlxx 3.0.2 C++ wrapper for MySQL's C API mysql-connector-java java/mysql-connector-java 5.0.7 MySQL Official JDBC connector for MySQL database. p5-class-dbi-mysql perl/p5-class-dbi-mysql 1.00 Extensions to Class::DBI for MySQL p5-dbd-mysql perl/p5-dbd-mysql 4.008 Perl5 Database Interface to the MySQL database py-mysql python/py-mysql 1.2.2 Python interface to mysql py25-mysql python/py25-mysql 1.2.2 Python interface to mysql rb-dbd-mysql ruby/rb-dbd-mysql 0.0.23 Ruby DBI driver for Mysql. OBSOLETE: please use dbd_mysql variant of rb-dbi rb-mysql ruby/rb-mysql 2.7.5 Ruby API for the Mysql database
MySQL の variants をチェック
$ port variants mysql5 mysql5 has the variants: universal server
いざインストール
$ sudo port install mysql5 +server .......
-
-
- > Fetching mysql5
- > Attempting to fetch mysql-5.0.67.tar.gz from http://distfiles.macports.org/mysql5
-
-
-
- > Installing mysql5 5.0.67_1+server
-
-
-
- > Activating mysql5 5.0.67_1+server
- > Cleaning mysql5
-
DBの初期化
上で言われた通りに
$ sudo -u mysql mysql_install_db5 ....... To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /opt/local/lib/mysql5/bin/mysqladmin -u root password 'new-password' /opt/local/lib/mysql5/bin/mysqladmin -u root -h Amateras.local password 'new-password' Alternatively you can run: /opt/local/lib/mysql5/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /opt/local ; /opt/local/lib/mysql5/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd mysql-test ; perl mysql-test-run.pl Please report any problems with the /opt/local/lib/mysql5/bin/mysqlbug script! The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com
って言われて無事終了。
MacPorts万歳 (`・ω・´)