Yulia Portnova | 0f99119 | 2015-04-24 16:56:52 +0300 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # install and configure mysql |
| 3 | DATABASE_PASSWORD=wally |
| 4 | DATBASE_USER=root |
| 5 | DB_NAME=tpcc |
| 6 | |
| 7 | # not prompting db password |
| 8 | debconf-set-selections <<MYSQL_PRESEED |
| 9 | mysql-server mysql-server/root_password password $DATABASE_PASSWORD |
| 10 | mysql-server mysql-server/root_password_again password $DATABASE_PASSWORD |
| 11 | mysql-server mysql-server/start_on_boot boolean true |
| 12 | MYSQL_PRESEED |
| 13 | |
| 14 | apt-get install -y mysql-server |
| 15 | apt-get install -y libmysqld-dev |
| 16 | apt-get install -y make |
| 17 | |
| 18 | # disable mysql profile in apparmor |
| 19 | sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ |
| 20 | sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld |
| 21 | |
| 22 | # allows us not to access mysql without specifying password |
| 23 | cat <<EOF >$HOME/.my.cnf |
| 24 | [client] |
| 25 | user=$DATABASE_USER |
| 26 | password=$DATABASE_PASSWORD |
| 27 | host=$DATABASE_HOST |
| 28 | EOF |
| 29 | |
| 30 | cd ~ |
| 31 | apt-get install bzr |
| 32 | bzr branch lp:~percona-dev/perconatools/tpcc-mysql |
| 33 | cd tpcc-mysql/src |
| 34 | make |
| 35 | |
| 36 | cd .. |
| 37 | mysql -e "CREATE DATABASE $DB_NAME;" |
| 38 | mysql "$DB_NAME" < create_table.sql |
| 39 | mysql "$DB_NAME" < add_fkey_idx.sql |
| 40 | |
| 41 | ./tpcc_load localhost "$DB_NAME" "$DATBASE_USER" "$DATABASE_PASSWORD" 20 |