macにMySQLをインストール
macにMySQLをインストールして起動、文字コードの確認まで。
$ brew install mysql ==> Downloading http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.20.tar.gz Already downloaded: /Users/futabooo/Library/Caches/Homebrew/mysql-5.5.20.tar.gz ==> Patching patching file scripts/mysqld_safe.sh patching file scripts/mysql_config.sh ==> cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/mysql/5.5.20 -DMYSQL_DATADIR=/usr/local/var/mys ==> make ==> make install ==> Caveats Set up databases to run AS YOUR USER ACCOUNT with: unset TMPDIR mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp To set up base tables in another folder, or use a different user to run mysqld, view the help for mysqld_install_db: mysql_install_db --help and view the MySQL documentation: * http://dev.mysql.com/doc/refman/5.5/en/mysql-install-db.html * http://dev.mysql.com/doc/refman/5.5/en/default-privileges.html To run as, for instance, user "mysql", you may need to `sudo`: sudo mysql_install_db ...options... Start mysqld manually with: mysql.server start Note: if this fails, you probably forgot to run the first two steps up above A "/etc/my.cnf" from another install may interfere with a Homebrew-built server starting up correctly. To connect: mysql -uroot To launch on startup: * if this is your first install: mkdir -p ~/Library/LaunchAgents cp /usr/local/Cellar/mysql/5.5.20/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist * if this is an upgrade and you already have the homebrew.mxcl.mysql.plist loaded: launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist cp /usr/local/Cellar/mysql/5.5.20/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist You may also need to edit the plist to use the correct "UserName". Warning: m4 macros were installed to "share/aclocal". Homebrew does not append "/usr/local/share/aclocal" to "/usr/share/aclocal/dirlist". If an autoconf script you use requires these m4 macros, you'll need to add this path manually. ==> Summary /usr/local/Cellar/mysql/5.5.20: 6336 files, 221M, built in 4.0 minutes $ brew list cairo gettext mysql pkg-config readline cmake git pango potrace sqlite fontforge glib pidof python wget gdbm libffi pixman python3 $ unset TMPDIR $ mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp 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: /usr/local/Cellar/mysql/5.5.20/bin/mysqladmin -u root password 'new-password' /usr/local/Cellar/mysql/5.5.20/bin/mysqladmin -u root -h futabooosmba password 'new-password' Alternatively you can run: /usr/local/Cellar/mysql/5.5.20/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 /usr/local/Cellar/mysql/5.5.20 ; /usr/local/Cellar/mysql/5.5.20/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/local/Cellar/mysql/5.5.20/mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/local/Cellar/mysql/5.5.20/scripts/mysqlbug script! $ mysql.server start Starting MySQL .. SUCCESS! $ mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.20 Source distribution Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show variables like 'character_set%'; +--------------------------+------------------------------------------------------+ | Variable_name | Value | +--------------------------+------------------------------------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/local/Cellar/mysql/5.5.20/share/mysql/charsets/ | +--------------------------+------------------------------------------------------+ 8 rows in set (0.00 sec)