Created
March 9, 2017 14:53
-
-
Save cl4u2/d3979104763fca97ec68d88059c6104c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DB_ROOT_USER=root | |
DB_ROOT_PASS=root | |
set -e | |
set -x | |
cat - <<EOF > /tmp/db_test0.sql | |
DROP DATABASE IF EXISTS vim_test0; | |
CREATE DATABASE vim_test0; | |
USE vim_test0; | |
DROP TABLE IF EXISTS testtabint; | |
CREATE TABLE testtabint ( | |
id smallint(5) NOT NULL, | |
name varchar(10), | |
PRIMARY KEY (id) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='testing it'; | |
GRANT ALL PRIVILEGES ON vim_test0.* TO 'vim'@'localhost' IDENTIFIED BY 'vimpw'; | |
EOF | |
cat - <<EOF > /tmp/insert_test0.sql | |
INSERT INTO testtabint (id, name) VALUES (12, 'ciao'); | |
EOF | |
cat - <<EOF > /tmp/delete_test0.sql | |
DELETE FROM testtabint WHERE name = 'ciao'; | |
EOF | |
mysql -u${DB_ROOT_USER} -p${DB_ROOT_PASS} < /tmp/db_test0.sql | |
sleep 1 | |
while [ 1 ]; do | |
echo "insert" | |
time mysql -uvim -pvimpw vim_test0 < /tmp/insert_test0.sql | |
sleep 5 | |
echo "delete" | |
time mysql -uvim -pvimpw vim_test0 < /tmp/delete_test0.sql | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment