create.sql 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # create benchmark user
  2. GRANT ALL ON *.* TO 'benchmarkdbuser'@'%' IDENTIFIED BY 'benchmarkdbpass';
  3. GRANT ALL ON *.* TO 'benchmarkdbuser'@'localhost' IDENTIFIED BY 'benchmarkdbpass';
  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. DROP PROCEDURE IF EXISTS load_data;
  16. DELIMITER #
  17. CREATE PROCEDURE load_data()
  18. BEGIN
  19. declare v_max int unsigned default 10000;
  20. declare v_counter int unsigned default 0;
  21. TRUNCATE TABLE World;
  22. START TRANSACTION;
  23. while v_counter < v_max do
  24. INSERT INTO World (randomNumber) VALUES ( floor(0 + (rand() * 10000)) );
  25. SET v_counter=v_counter+1;
  26. end while;
  27. commit;
  28. END #
  29. DELIMITER ;
  30. CALL load_data();
  31. DROP TABLE IF EXISTS Fortune;
  32. CREATE TABLE Fortune (
  33. id int(10) unsigned NOT NULL auto_increment,
  34. message varchar(2048) CHARACTER SET 'utf8' NOT NULL,
  35. PRIMARY KEY (id)
  36. )
  37. ENGINE=INNODB;
  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 ('フレームワークのベンチマーク');