create.sql 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. CREATE DATABASE hello_world;
  6. USE hello_world;
  7. CREATE TABLE world (
  8. id int(10) unsigned NOT NULL auto_increment,
  9. randomNumber int NOT NULL default 0,
  10. PRIMARY KEY (id)
  11. )
  12. ENGINE=INNODB;
  13. GRANT SELECT, UPDATE ON hello_world.world TO 'benchmarkdbuser'@'%' IDENTIFIED BY 'benchmarkdbpass';
  14. GRANT SELECT, UPDATE ON hello_world.world TO 'benchmarkdbuser'@'localhost' IDENTIFIED BY 'benchmarkdbpass';
  15. DELIMITER #
  16. CREATE PROCEDURE load_data()
  17. BEGIN
  18. declare v_max int unsigned default 10000;
  19. declare v_counter int unsigned default 0;
  20. TRUNCATE TABLE world;
  21. START TRANSACTION;
  22. while v_counter < v_max do
  23. INSERT INTO world (randomNumber) VALUES ( floor(0 + (rand() * 10000)) );
  24. SET v_counter=v_counter+1;
  25. end while;
  26. commit;
  27. END #
  28. DELIMITER ;
  29. CALL load_data();
  30. CREATE TABLE fortune (
  31. id int(10) unsigned NOT NULL auto_increment,
  32. message varchar(2048) CHARACTER SET 'utf8' NOT NULL,
  33. PRIMARY KEY (id)
  34. )
  35. ENGINE=INNODB;
  36. GRANT SELECT ON hello_world.fortune TO 'benchmarkdbuser'@'%' IDENTIFIED BY 'benchmarkdbpass';
  37. GRANT SELECT ON hello_world.fortune TO 'benchmarkdbuser'@'localhost' IDENTIFIED BY 'benchmarkdbpass';
  38. INSERT INTO fortune (message) VALUES ('fortune: No such file or directory');
  39. INSERT INTO fortune (message) VALUES ('A computer scientist is someone who fixes things that aren''t broken.');
  40. INSERT INTO fortune (message) VALUES ('After enough decimal places, nobody gives a damn.');
  41. INSERT INTO fortune (message) VALUES ('A bad random number generator: 1, 1, 1, 1, 1, 4.33e+67, 1, 1, 1');
  42. INSERT INTO fortune (message) VALUES ('A computer program does what you tell it to do, not what you want it to do.');
  43. INSERT INTO fortune (message) VALUES ('Emacs is a nice operating system, but I prefer UNIX. — Tom Christaensen');
  44. INSERT INTO fortune (message) VALUES ('Any program that runs right is obsolete.');
  45. INSERT INTO fortune (message) VALUES ('A list is only as strong as its weakest link. — Donald Knuth');
  46. INSERT INTO fortune (message) VALUES ('Feature: A bug with seniority.');
  47. INSERT INTO fortune (message) VALUES ('Computers make very fast, very accurate mistakes.');
  48. INSERT INTO fortune (message) VALUES ('<script>alert("This should not be displayed in a browser alert box.");</script>');
  49. INSERT INTO fortune (message) VALUES ('フレームワークのベンチマーク');