Maria DB 설치(OSX Maverick)

MariaDB 설치를 진행하도록 한다. MySQL이 짜증나므로...
그런데 이 사람들... 가난한가보다. osx 바이너리가 5.5.24 이후로 없어서 '뭐지 이거?' 하면서 홈페이지 여기 저기 뒤지다 보니 homebrew로 설치하는 방법만 있더라. 그러면서 하는 얘기가

Why are there no binaries for Mac on the download page

MariaDB is an open source project and to be able to provide binaries for a platform we need someone to:
- Provide a Mac OSX buildbot slave where we can do the builds.
- Help us creating proper Mac OSX packages.
Sponsor us with a Mac OSX machine for the builds.
왠지 불쌍함... 뭐 어쨌든 진행한다. 아무래도 소스 받아서 컴파일하는 방법으로 하는 것도 좋아보이지만 과정이 너무 복잡하다... 그냥 homebrew 이용.
일단 업데이트먼저.


brew update

새로 업데이트된 놈들, 삭제된 목록이 쫙 뜬다. 별 의미는 없는 듯. 목록에 항목들이 많으므로 mariadb가 있는지 찾으려면
brew search mariadb

결과가 있는 경우 자세한 정보를 보려면
brew info mariadb

궁금해서 해봤다.
/usr/local> brew info mariadb
mariadb: stable 5.5.32, devel 10.0.3
http://mariadb.org/
Conflicts with: mysql, mysql-cluster, percona-server
Not installed
From: https://github.com/mxcl/homebrew/commits/master/Library/Formula/mariadb.rb
==> Dependencies
Build: cmake
==> Options
--enable-local-infile
Build with local infile loading support
--universal
Build a universal binary
--with-archive-storage-engine
Compile with the ARCHIVE storage engine enabled
--with-bench
Keep benchmark app when installing
--with-blackhole-storage-engine
Compile with the BLACKHOLE storage engine enabled
--with-embedded
Build the embedded server
--with-libedit
Compile with editline wrapper instead of readline
--with-tests
Keep test when installing
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
To connect:
mysql -uroot
To have launchd start mariadb at login:
ln -sfv /usr/local/opt/mariadb/*.plist ~/Library/LaunchAgents
Then to load mariadb now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
Or, if you don't want/need launchctl, you can just run:
mysql.server start

옛날 버전인줄 알았더니 다행스럽게도 최신 stable 버전. 이제 install 진행
brew install mariadb

헐, 실패다.
/usr/local> brew install mariadb
==> Installing mariadb dependency: cmake
==> Downloading http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz
######################################################################## 100.0%
==> ./bootstrap --prefix=/usr/local/Cellar/cmake/2.8.12 --system-libs --no-system-libarchive --datadir=/share/cmake --docdir=/share/doc/c
==> make
==> make install

🍺  /usr/local/Cellar/cmake/2.8.12: 701 files, 36M, built in 2.8 minutes
==> Installing mariadb
Error: This formula cannot be built with any available compilers.
To install this formula, you may need to:
brew install apple-gcc42

gcc가 없나봐. 에러 메시지에 나온대로 gcc 설치하고 다시 인스톨 시도.
/usr/local> brew install mariadb
==> Downloading http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.32/kvm-tarbake-jaunty-x86/mariadb-5.5.32.tar.gz
######################################################################## 100.0%
==> cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/mariadb/5.5.32 -DMYSQL_DATADIR=/usr/local/var/mysql -DINSTALL_MANDIR=/usr/local/Cell
==> make
[  3%] Building C object cmd-line-utils/readline/CMakeFiles/readline.dir/compat.c.o
[  3%] Building C object cmd-line-utils/readline/CMakeFiles/readline.dir/savestring.c.o
Linking C static library libreadline.a
[  3%] Built target readline
make: *** [all] Error 2
READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting
These open issues may also help:
https://github.com/mxcl/homebrew/issues/23475

또 에러네. 천천히 하자.
일단 에러메시지에 나온 페이지를 정독, Read this로 가리키는 페이지의 내용은 나랑 관계 없어 보이고 issue 페이지의 글을 보니 딱 이거네.
대응이 빠르다. osx 10.9에서 이거 깔다가 실패한 애들끼리 털고 있는 건데 아무래도 난 어제 xcode 업데이트하면서 설치한 줄 알았던 CLT(Commend Line developer Tools)가 제대로 안 깔린 듯.
다시 설치한다.
xcode-select --install

이제 설치할거냐고 묻는 대화창이 나오고 그냥 설치하겠다고 하면 됨. 이제 설치도 끝났으니 다시 시도.
/usr/local> brew install mariadb
==> Downloading http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.32/kvm-tarbake-jaunty-x86/mariadb-5.5.32.tar.gz
Already downloaded: /Library/Caches/Homebrew/mariadb-5.5.32.tar.gz
==> cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/mariadb/5.5.32 -DMYSQL_DATADIR=/usr/local/var/mysql -DINSTALL_MANDIR=/usr/local/Cell
==> make
==> make install
==> /usr/local/Cellar/mariadb/5.5.32/bin/mysql_install_db --verbose --user=yangsaerohoon --basedir=/usr/local/Cellar/mariadb/5.5.32 --dat
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
To connect:
mysql -uroot
To have launchd start mariadb at login:
ln -sfv /usr/local/opt/mariadb/*.plist ~/Library/LaunchAgents
Then to load mariadb now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
Or, if you don't want/need launchctl, you can just run:
mysql.server start
==> Summary
🍺  /usr/local/Cellar/mariadb/5.5.32: 481 files, 114M, built in 3.2 minutes

끝난 것 같다.
이제 빌드가 끝났으니 MariaDB를 설치한다. 아래의 명령어를 실행.
/usr/local> unset TMPDIR
/usr/local> mysql_install_db
Installing MariaDB/MySQL system tables in './data' ...
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 MariaDB root USER !
To do so, start the server, then issue the following commands:
'./bin/mysqladmin' -u root password 'new-password'
'./bin/mysqladmin' -u root -h Saerohoon-ui-iMac.local password 'new-password'
Alternatively you can run:
'./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 MariaDB Knowledgebase at http://kb.askmonty.org or the
MySQL manual for more instructions.
You can start the MariaDB daemon with:
cd '.' ; ./bin/mysqld_safe --datadir='./data'
You can test the MariaDB daemon with mysql-test-run.pl
cd './mysql-test' ; perl mysql-test-run.pl
Please report any problems with the './bin/mysqlbug' script!
The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Support MariaDB development by buying support/new features from
Monty Program Ab. You can contact us about this at sales@montyprogram.com.
Alternatively consider joining our community based development effort:
http://kb.askmonty.org/en/contributing-to-the-mariadb-project/
/usr/local>

설치가 끝났으니 실행한다.
만약에 production 장비에서 실행하는 경우 mysql_secure_installation 으로 실행해야 한다. 그냥 테스트하는 것이라면 아래를 따라한다.
/usr/local/Cellar/mariadb/5.5.32> cd /usr/local/Cellar/mariadb/5.5.32/bin/
/usr/local/Cellar/mariadb/5.5.32/bin> mysqld_safe --datadir=/usr/local/var/mysql
131024 14:05:24 mysqld_safe Logging to '/usr/local/var/mysql/Saerohoon-ui-iMac.local.err'.
131024 14:05:24 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql

이제 mysql로 시작할 수 있다.
~> mysql -uroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.32-MariaDB Source distribution

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> select version();
+----------------+
| version()      |
+----------------+
| 5.5.32-MariaDB |
+----------------+
1 row in set (0.00 sec)

MariaDB [(none)]>

서비스로 만드는 것은 나중에... 일단 잘 돌아가는 것 같다.

댓글 없음:

댓글 쓰기