blob: 13804d37eb6886d8dd6aef1e3f2a5b8224b87ba2 [file] [log] [blame]
Yulia Portnova0f991192015-04-24 16:56:52 +03001#!/bin/bash
2# install and configure mysql
Yulia Portnovab1a15072015-05-06 14:59:25 +03003set -e
4set -x
5
Yulia Portnova0f991192015-04-24 16:56:52 +03006DATABASE_PASSWORD=wally
7DATBASE_USER=root
8DB_NAME=tpcc
9
10# not prompting db password
11debconf-set-selections <<MYSQL_PRESEED
12mysql-server mysql-server/root_password password $DATABASE_PASSWORD
13mysql-server mysql-server/root_password_again password $DATABASE_PASSWORD
14mysql-server mysql-server/start_on_boot boolean true
15MYSQL_PRESEED
16
17apt-get install -y mysql-server
18apt-get install -y libmysqld-dev
19apt-get install -y make
20
21# disable mysql profile in apparmor
Yulia Portnovab1a15072015-05-06 14:59:25 +030022#sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
23#sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
Yulia Portnova0f991192015-04-24 16:56:52 +030024
25# allows us not to access mysql without specifying password
26cat <<EOF >$HOME/.my.cnf
27[client]
28user=$DATABASE_USER
29password=$DATABASE_PASSWORD
30host=$DATABASE_HOST
31EOF
32
33cd ~
Yulia Portnovab1a15072015-05-06 14:59:25 +030034apt-get -y install bzr
Yulia Portnova0f991192015-04-24 16:56:52 +030035bzr branch lp:~percona-dev/perconatools/tpcc-mysql
36cd tpcc-mysql/src
37make
38
39cd ..
40mysql -e "CREATE DATABASE $DB_NAME;"
41mysql "$DB_NAME" < create_table.sql
42mysql "$DB_NAME" < add_fkey_idx.sql
43
44./tpcc_load localhost "$DB_NAME" "$DATBASE_USER" "$DATABASE_PASSWORD" 20