牌語備忘録 -pygo

あくまでもメモです。なるべくオフィシャルの情報を参照してください。

牌語備忘録 -pygo

MacPorts でMySQL5.5 をインストールするメモ

2013-09-16: 書き直した

(macosx10.8)

インストール

$ sudo port install mysql55-server
--->  Computing dependencies for mysql55-server
--->  Dependencies to be installed: mysql55
--->  Fetching archive for mysql55
--->  Attempting to fetch mysql55-5.5.33_0.darwin_12.x86_64.tbz2 from http://jog.id.packages.macports.org/macports/packages/mysql55
--->  Attempting to fetch mysql55-5.5.33_0.darwin_12.x86_64.tbz2.rmd160 from http://jog.id.packages.macports.org/macports/packages/mysql55
--->  Installing mysql55 @5.5.33_0
The mysql55 client has been installed.
To install the mysql55 server, install the mysql55-server port.
--->  Activating mysql55 @5.5.33_0
--->  Cleaning mysql55
--->  Fetching archive for mysql55-server
--->  Attempting to fetch mysql55-server-5.5.33_0.darwin_12.noarch.tbz2 from http://jog.id.packages.macports.org/macports/packages/mysql55-server
--->  Attempting to fetch mysql55-server-5.5.33_0.darwin_12.noarch.tbz2.rmd160 from http://jog.id.packages.macports.org/macports/packages/mysql55-server
--->  Installing mysql55-server @5.5.33_0
--->  Activating mysql55-server @5.5.33_0

If this is a new install you might want to run:

$ sudo -u _mysql /opt/local/lib/mysql55/bin/mysql_install_db

--->  Cleaning mysql55-server
--->  Updating database of binaries: 100.0%
--->  Scanning binaries for linking errors: 100.0%
--->  No broken files found.
5/bin/mysql_install_db
Installing MySQL system tables...
OK
Filling help tables...
OK

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/mysql55/bin/mysqladmin -u root password 'new-password'
/opt/local/lib/mysql55/bin/mysqladmin -u root -h USERNAME.local password 'new-password'

Alternatively you can run:
/opt/local/lib/mysql55/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/mysql55/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /opt/local/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /opt/local/lib/mysql55/bin/mysqlbug script!

初期化スクリプト

$ sudo -u _mysql /opt/local/lib/mysql55/bin/mysql_install_db

対話形式で設定

$ /opt/local/lib/mysql55/bin/mysql_secure_installation

参考

設定

デフォルトに『skip-networking』が入っているので外す
これはいってると Sequel Pro で読めないっぽい

/opt/local/etc/mysql55/macports-default.cnf

(このファイルは変更しない)

# WARNING! ANY CHANGES TO THIS FILE WILL BE LOST ON UNINSTALL/UPGRADES!
# Make your changes to /opt/local/etc/mysql55/my.cnf
# YOU HAVE BEEN WARNED!

# MacPorts default options
[mysqld]
# skip-networking so multple mysql server ports can be loaded
# without each competing for port 3306.
skip-networking
/opt/local/etc/mysql55/my.cnf

このファイルで設定を変える

  1. 『skip-networking』はっている macports-default.cnf を読み込まないようにコメントアウト
  2. ポートを一応3306にしておく(設定しないと『0』になるっぽい)
# Use default MacPorts settings
# !include /opt/local/etc/mysql55/macports-default.cnf

#add
[client]
port= 3306

[mysqld]
port= 3306