Skip to content

Instantly share code, notes, and snippets.

@masaki
Forked from xaicron/mqh_install.sh
Created December 11, 2011 15:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save masaki/1461033 to your computer and use it in GitHub Desktop.
Save masaki/1461033 to your computer and use it in GitHub Desktop.
Installing MySQL5.1 / Q4M / HandlerSocket
#!/bin/sh
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://github.com/adamv/homebrew-alt/raw/master/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