create.sql 2.6 KB

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