Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installing MySQL5.1 / Q4M / HandlerSocket
#!/bin/zsh
if [ `which perl` = "/usr/bin/perl" ]; then
echo -n -e "\e[1;31mUSING SYSTEM PERL OK? [y/n]\e[m: "
read ANSWER
if [ "$ANSWER" != "y" ]; then
exit 255
fi
PERL_CPANM_OPT="$PERL_CPANM_OPT --sudo"
fi
### MySQL
echo -e "\e[1;32mStarting MySQL5.1 installation.\e[m"
brew install https://raw.github.com/adamv/homebrew-alt/8caa6bc09dbe1b50be0b72840afb131eef1edb95/versions/mysql51.rb --with-utf8-default --use-gcc
mysql_install_db --basedir=/usr/local/Cellar/mysql51/5.1.58
mysql.server start
### reinstall DBD::mysql
curl -fsSL http://xrl.us/cpanm | perl - --reinstall -n DBD::mysql
### Build MySQL source
### Please FIXME!!
echo -e "\e[1;32mStarting build MySQL.\e[m"
mkdir ~/tmp
cp `brew --cache`/mysql51-5.1.58.tar.gz ~/tmp
cd ~/tmp
tar xfz mysql51-5.1.58.tar.gz
cd mysql-5.1.58/
./configure --without-docs --without-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/mysql51/5.1.58 \
--localstatedir=/usr/local/var/mysql --sysconfdir=/usr/local/etc --with-plugins=innobase,myisam \
--with-extra-charsets=complex --with-ssl --with-readline --enable-assembler --enable-thread-safe-client \
--enable-local-infile --enable-shared --with-partition --with-charset=utf8
#env CXXPLAGS="-O3 -march=core2 -msse4.1 -w -pipe -fno-omit-frame-pointer -felide-constructors" make
### Q4M
echo -e "\e[1;32mStarting Q4M installation.\e[m"
cd ~/tmp
curl -O http://q4m.kazuhooku.com/dist/q4m-0.9.5.tar.gz
tar zxfv q4m-0.9.5.tar.gz
cd q4m-0.9.5
./configure --prefix=/usr/local/Cellar/mysql51/5.1.58 --with-mysql=$HOME/tmp/mysql-5.1.58
make && make install
mysql -u root < support-files/install.sql
mysql -u root -e 'show plugins'
# perl run_tests.pl
### HS
echo -e "\e[1;32mStarting HandlerSocket installation.\e[m"
cd ~/tmp
git clone git://github.com/ahiguti/HandlerSocket-Plugin-for-MySQL.git
cd HandlerSocket-Plugin-for-MySQL
./autogen.sh
./configure --with-mysql-source=$HOME/tmp/mysql-5.1.58 --with-mysql-bindir=/usr/local/Cellar/mysql51/5.1.58/bin
make && make install
mysql -u root -e "install plugin handlersocket soname 'handlersocket.so'"
cd perl-Net-HandlerSocket
curl -fsSL http://xrl.us/cpanm | perl - .
### finish
mysql -uroot -e 'show plugins'
echo -e "\e[1;32mdone.\e[m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment