create.sql 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # To maintain consistency across servers and fix a problem with the jdbc per
  2. # http://stackoverflow.com/questions/37719818/the-server-time-zone-value-aest-is-unrecognized-or-represents-more-than-one-ti
  3. SET GLOBAL time_zone = '+00:00';
  4. # modified from SO answer http://stackoverflow.com/questions/5125096/for-loop-in-mysql
  5. DROP DATABASE IF EXISTS hello_world;
  6. CREATE DATABASE hello_world;
  7. USE hello_world;
  8. DROP TABLE IF EXISTS world;
  9. CREATE TABLE world (
  10. id int(10) unsigned NOT NULL auto_increment,
  11. randomNumber int NOT NULL default 0,
  12. PRIMARY KEY (id)
  13. )
  14. ENGINE=INNODB;
  15. GRANT SELECT, UPDATE ON hello_world.world TO 'benchmarkdbuser'@'%' IDENTIFIED BY 'benchmarkdbpass';
  16. GRANT SELECT, UPDATE ON hello_world.world TO 'benchmarkdbuser'@'localhost' IDENTIFIED BY 'benchmarkdbpass';
  17. DROP PROCEDURE IF EXISTS load_data;
  18. DELIMITER #
  19. CREATE PROCEDURE load_data()
  20. BEGIN
  21. declare v_max int unsigned default 10000;
  22. declare v_counter int unsigned default 0;
  23. TRUNCATE TABLE world;
  24. START TRANSACTION;
  25. while v_counter < v_max do
  26. INSERT INTO world (randomNumber) VALUES ( floor(0 + (rand() * 10000)) );
  27. SET v_counter=v_counter+1;
  28. end while;
  29. commit;
  30. END #
  31. DELIMITER ;
  32. CALL load_data();
  33. DROP TABLE IF EXISTS fortune;
  34. CREATE TABLE fortune (
  35. id int(10) unsigned NOT NULL auto_increment,
  36. message varchar(2048) CHARACTER SET 'utf8' NOT NULL,
  37. PRIMARY KEY (id)
  38. )
  39. ENGINE=INNODB;
  40. GRANT SELECT ON hello_world.fortune TO 'benchmarkdbuser'@'%' IDENTIFIED BY 'benchmarkdbpass';
  41. GRANT SELECT ON hello_world.fortune TO 'benchmarkdbuser'@'localhost' IDENTIFIED BY 'benchmarkdbpass';
  42. INSERT INTO fortune (message) VALUES ('fortune: No such file or directory');
  43. INSERT INTO fortune (message) VALUES ('A computer scientist is someone who fixes things that aren''t broken.');
  44. INSERT INTO fortune (message) VALUES ('After enough decimal places, nobody gives a damn.');
  45. INSERT INTO fortune (message) VALUES ('A bad random number generator: 1, 1, 1, 1, 1, 4.33e+67, 1, 1, 1');
  46. INSERT INTO fortune (message) VALUES ('A computer program does what you tell it to do, not what you want it to do.');
  47. INSERT INTO fortune (message) VALUES ('Emacs is a nice operating system, but I prefer UNIX. — Tom Christaensen');
  48. INSERT INTO fortune (message) VALUES ('Any program that runs right is obsolete.');
  49. INSERT INTO fortune (message) VALUES ('A list is only as strong as its weakest link. — Donald Knuth');
  50. INSERT INTO fortune (message) VALUES ('Feature: A bug with seniority.');
  51. INSERT INTO fortune (message) VALUES ('Computers make very fast, very accurate mistakes.');
  52. INSERT INTO fortune (message) VALUES ('<script>alert("This should not be displayed in a browser alert box.");</script>');
  53. INSERT INTO fortune (message) VALUES ('フレームワークのベンチマーク');