create_tables.sql 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. -- --------------------------------------------------------
  2. -- SQL Commands to set up the pmadb as described in the documentation.
  3. --
  4. -- This file is meant for use with MySQL 5 and above!
  5. --
  6. -- This script expects the user pma to already be existing. If we would put a
  7. -- line here to create him too many users might just use this script and end
  8. -- up with having the same password for the controluser.
  9. --
  10. -- This user "pma" must be defined in config.inc.php (controluser/controlpass)
  11. --
  12. -- Please don't forget to set up the tablenames in config.inc.php
  13. --
  14. -- --------------------------------------------------------
  15. --
  16. -- Database : `phpmyadmin`
  17. --
  18. CREATE DATABASE IF NOT EXISTS `phpmyadmin`
  19. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  20. USE phpmyadmin;
  21. -- --------------------------------------------------------
  22. --
  23. -- Privileges
  24. --
  25. -- (activate this statement if necessary)
  26. -- GRANT SELECT, INSERT, DELETE, UPDATE, ALTER ON `phpmyadmin`.* TO
  27. -- 'pma'@localhost;
  28. -- --------------------------------------------------------
  29. --
  30. -- Table structure for table `pma__bookmark`
  31. --
  32. CREATE TABLE IF NOT EXISTS `pma__bookmark` (
  33. `id` int(10) unsigned NOT NULL auto_increment,
  34. `dbase` varchar(255) NOT NULL default '',
  35. `user` varchar(255) NOT NULL default '',
  36. `label` varchar(255) COLLATE utf8_general_ci NOT NULL default '',
  37. `query` text NOT NULL,
  38. PRIMARY KEY (`id`)
  39. )
  40. COMMENT='Bookmarks'
  41. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  42. -- --------------------------------------------------------
  43. --
  44. -- Table structure for table `pma__column_info`
  45. --
  46. CREATE TABLE IF NOT EXISTS `pma__column_info` (
  47. `id` int(5) unsigned NOT NULL auto_increment,
  48. `db_name` varchar(64) NOT NULL default '',
  49. `table_name` varchar(64) NOT NULL default '',
  50. `column_name` varchar(64) NOT NULL default '',
  51. `comment` varchar(255) COLLATE utf8_general_ci NOT NULL default '',
  52. `mimetype` varchar(255) COLLATE utf8_general_ci NOT NULL default '',
  53. `transformation` varchar(255) NOT NULL default '',
  54. `transformation_options` varchar(255) NOT NULL default '',
  55. `input_transformation` varchar(255) NOT NULL default '',
  56. `input_transformation_options` varchar(255) NOT NULL default '',
  57. PRIMARY KEY (`id`),
  58. UNIQUE KEY `db_name` (`db_name`,`table_name`,`column_name`)
  59. )
  60. COMMENT='Column information for phpMyAdmin'
  61. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  62. -- --------------------------------------------------------
  63. --
  64. -- Table structure for table `pma__history`
  65. --
  66. CREATE TABLE IF NOT EXISTS `pma__history` (
  67. `id` bigint(20) unsigned NOT NULL auto_increment,
  68. `username` varchar(64) NOT NULL default '',
  69. `db` varchar(64) NOT NULL default '',
  70. `table` varchar(64) NOT NULL default '',
  71. `timevalue` timestamp NOT NULL default CURRENT_TIMESTAMP,
  72. `sqlquery` text NOT NULL,
  73. PRIMARY KEY (`id`),
  74. KEY `username` (`username`,`db`,`table`,`timevalue`)
  75. )
  76. COMMENT='SQL history for phpMyAdmin'
  77. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  78. -- --------------------------------------------------------
  79. --
  80. -- Table structure for table `pma__pdf_pages`
  81. --
  82. CREATE TABLE IF NOT EXISTS `pma__pdf_pages` (
  83. `db_name` varchar(64) NOT NULL default '',
  84. `page_nr` int(10) unsigned NOT NULL auto_increment,
  85. `page_descr` varchar(50) COLLATE utf8_general_ci NOT NULL default '',
  86. PRIMARY KEY (`page_nr`),
  87. KEY `db_name` (`db_name`)
  88. )
  89. COMMENT='PDF relation pages for phpMyAdmin'
  90. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  91. -- --------------------------------------------------------
  92. --
  93. -- Table structure for table `pma__recent`
  94. --
  95. CREATE TABLE IF NOT EXISTS `pma__recent` (
  96. `username` varchar(64) NOT NULL,
  97. `tables` text NOT NULL,
  98. PRIMARY KEY (`username`)
  99. )
  100. COMMENT='Recently accessed tables'
  101. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  102. -- --------------------------------------------------------
  103. --
  104. -- Table structure for table `pma__favorite`
  105. --
  106. CREATE TABLE IF NOT EXISTS `pma__favorite` (
  107. `username` varchar(64) NOT NULL,
  108. `tables` text NOT NULL,
  109. PRIMARY KEY (`username`)
  110. )
  111. COMMENT='Favorite tables'
  112. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  113. -- --------------------------------------------------------
  114. --
  115. -- Table structure for table `pma__table_uiprefs`
  116. --
  117. CREATE TABLE IF NOT EXISTS `pma__table_uiprefs` (
  118. `username` varchar(64) NOT NULL,
  119. `db_name` varchar(64) NOT NULL,
  120. `table_name` varchar(64) NOT NULL,
  121. `prefs` text NOT NULL,
  122. `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  123. PRIMARY KEY (`username`,`db_name`,`table_name`)
  124. )
  125. COMMENT='Tables'' UI preferences'
  126. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  127. -- --------------------------------------------------------
  128. --
  129. -- Table structure for table `pma__relation`
  130. --
  131. CREATE TABLE IF NOT EXISTS `pma__relation` (
  132. `master_db` varchar(64) NOT NULL default '',
  133. `master_table` varchar(64) NOT NULL default '',
  134. `master_field` varchar(64) NOT NULL default '',
  135. `foreign_db` varchar(64) NOT NULL default '',
  136. `foreign_table` varchar(64) NOT NULL default '',
  137. `foreign_field` varchar(64) NOT NULL default '',
  138. PRIMARY KEY (`master_db`,`master_table`,`master_field`),
  139. KEY `foreign_field` (`foreign_db`,`foreign_table`)
  140. )
  141. COMMENT='Relation table'
  142. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  143. -- --------------------------------------------------------
  144. --
  145. -- Table structure for table `pma__table_coords`
  146. --
  147. CREATE TABLE IF NOT EXISTS `pma__table_coords` (
  148. `db_name` varchar(64) NOT NULL default '',
  149. `table_name` varchar(64) NOT NULL default '',
  150. `pdf_page_number` int(11) NOT NULL default '0',
  151. `x` float unsigned NOT NULL default '0',
  152. `y` float unsigned NOT NULL default '0',
  153. PRIMARY KEY (`db_name`,`table_name`,`pdf_page_number`)
  154. )
  155. COMMENT='Table coordinates for phpMyAdmin PDF output'
  156. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  157. -- --------------------------------------------------------
  158. --
  159. -- Table structure for table `pma__table_info`
  160. --
  161. CREATE TABLE IF NOT EXISTS `pma__table_info` (
  162. `db_name` varchar(64) NOT NULL default '',
  163. `table_name` varchar(64) NOT NULL default '',
  164. `display_field` varchar(64) NOT NULL default '',
  165. PRIMARY KEY (`db_name`,`table_name`)
  166. )
  167. COMMENT='Table information for phpMyAdmin'
  168. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  169. -- --------------------------------------------------------
  170. --
  171. -- Table structure for table `pma__tracking`
  172. --
  173. CREATE TABLE IF NOT EXISTS `pma__tracking` (
  174. `db_name` varchar(64) NOT NULL,
  175. `table_name` varchar(64) NOT NULL,
  176. `version` int(10) unsigned NOT NULL,
  177. `date_created` datetime NOT NULL,
  178. `date_updated` datetime NOT NULL,
  179. `schema_snapshot` text NOT NULL,
  180. `schema_sql` text,
  181. `data_sql` longtext,
  182. `tracking` set('UPDATE','REPLACE','INSERT','DELETE','TRUNCATE','CREATE DATABASE','ALTER DATABASE','DROP DATABASE','CREATE TABLE','ALTER TABLE','RENAME TABLE','DROP TABLE','CREATE INDEX','DROP INDEX','CREATE VIEW','ALTER VIEW','DROP VIEW') default NULL,
  183. `tracking_active` int(1) unsigned NOT NULL default '1',
  184. PRIMARY KEY (`db_name`,`table_name`,`version`)
  185. )
  186. COMMENT='Database changes tracking for phpMyAdmin'
  187. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  188. -- --------------------------------------------------------
  189. --
  190. -- Table structure for table `pma__userconfig`
  191. --
  192. CREATE TABLE IF NOT EXISTS `pma__userconfig` (
  193. `username` varchar(64) NOT NULL,
  194. `timevalue` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  195. `config_data` text NOT NULL,
  196. PRIMARY KEY (`username`)
  197. )
  198. COMMENT='User preferences storage for phpMyAdmin'
  199. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  200. -- --------------------------------------------------------
  201. --
  202. -- Table structure for table `pma__users`
  203. --
  204. CREATE TABLE IF NOT EXISTS `pma__users` (
  205. `username` varchar(64) NOT NULL,
  206. `usergroup` varchar(64) NOT NULL,
  207. PRIMARY KEY (`username`,`usergroup`)
  208. )
  209. COMMENT='Users and their assignments to user groups'
  210. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  211. -- --------------------------------------------------------
  212. --
  213. -- Table structure for table `pma__usergroups`
  214. --
  215. CREATE TABLE IF NOT EXISTS `pma__usergroups` (
  216. `usergroup` varchar(64) NOT NULL,
  217. `tab` varchar(64) NOT NULL,
  218. `allowed` enum('Y','N') NOT NULL DEFAULT 'N',
  219. PRIMARY KEY (`usergroup`,`tab`,`allowed`)
  220. )
  221. COMMENT='User groups with configured menu items'
  222. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  223. -- --------------------------------------------------------
  224. --
  225. -- Table structure for table `pma__navigationhiding`
  226. --
  227. CREATE TABLE IF NOT EXISTS `pma__navigationhiding` (
  228. `username` varchar(64) NOT NULL,
  229. `item_name` varchar(64) NOT NULL,
  230. `item_type` varchar(64) NOT NULL,
  231. `db_name` varchar(64) NOT NULL,
  232. `table_name` varchar(64) NOT NULL,
  233. PRIMARY KEY (`username`,`item_name`,`item_type`,`db_name`,`table_name`)
  234. )
  235. COMMENT='Hidden items of navigation tree'
  236. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  237. -- --------------------------------------------------------
  238. --
  239. -- Table structure for table `pma__savedsearches`
  240. --
  241. CREATE TABLE IF NOT EXISTS `pma__savedsearches` (
  242. `id` int(5) unsigned NOT NULL auto_increment,
  243. `username` varchar(64) NOT NULL default '',
  244. `db_name` varchar(64) NOT NULL default '',
  245. `search_name` varchar(64) NOT NULL default '',
  246. `search_data` text NOT NULL,
  247. PRIMARY KEY (`id`),
  248. UNIQUE KEY `u_savedsearches_username_dbname` (`username`,`db_name`,`search_name`)
  249. )
  250. COMMENT='Saved searches'
  251. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  252. -- --------------------------------------------------------
  253. --
  254. -- Table structure for table `pma__central_columns`
  255. --
  256. CREATE TABLE IF NOT EXISTS `pma__central_columns` (
  257. `db_name` varchar(64) NOT NULL,
  258. `col_name` varchar(64) NOT NULL,
  259. `col_type` varchar(64) NOT NULL,
  260. `col_length` text,
  261. `col_collation` varchar(64) NOT NULL,
  262. `col_isNull` boolean NOT NULL,
  263. `col_extra` varchar(255) default '',
  264. `col_default` text,
  265. PRIMARY KEY (`db_name`,`col_name`)
  266. )
  267. COMMENT='Central list of columns'
  268. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  269. -- --------------------------------------------------------
  270. --
  271. -- Table structure for table `pma__designer_settings`
  272. --
  273. CREATE TABLE IF NOT EXISTS `pma__designer_settings` (
  274. `username` varchar(64) NOT NULL,
  275. `settings_data` text NOT NULL,
  276. PRIMARY KEY (`username`)
  277. )
  278. COMMENT='Settings related to Designer'
  279. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
  280. -- --------------------------------------------------------
  281. --
  282. -- Table structure for table `pma__export_templates`
  283. --
  284. CREATE TABLE IF NOT EXISTS `pma__export_templates` (
  285. `id` int(5) unsigned NOT NULL AUTO_INCREMENT,
  286. `username` varchar(64) NOT NULL,
  287. `export_type` varchar(10) NOT NULL,
  288. `template_name` varchar(64) NOT NULL,
  289. `template_data` text NOT NULL,
  290. PRIMARY KEY (`id`),
  291. UNIQUE KEY `u_user_type_template` (`username`,`export_type`,`template_name`)
  292. )
  293. COMMENT='Saved export templates'
  294. DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;