schema.sql 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. USE mysql;
  2. REPLACE INTO user (Host, User, Password) VALUES ('localhost','radius','radpass');
  3. REPLACE INTO db (Host, Db, User, Select_priv) VALUES ('localhost','radius','radius','Y');
  4. GRANT USAGE ON * . * TO 'radius'@'localhost' IDENTIFIED BY 'radpass';
  5. CREATE DATABASE IF NOT EXISTS radius;
  6. FLUSH PRIVILEGES;
  7. GRANT ALL PRIVILEGES ON radius . * TO 'radius'@'localhost';
  8. FLUSH PRIVILEGES;
  9. USE radius;
  10. CREATE TABLE IF NOT EXISTS `badusers` (
  11. `id` int(10) NOT NULL AUTO_INCREMENT,
  12. `UserName` varchar(30) DEFAULT NULL,
  13. `Date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  14. `Reason` varchar(200) DEFAULT NULL,
  15. `Admin` varchar(30) DEFAULT '-',
  16. PRIMARY KEY (`id`),
  17. KEY `UserName` (`UserName`),
  18. KEY `Date` (`Date`)
  19. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  20. -- --------------------------------------------------------
  21. --
  22. -- Estructura de tabla para la tabla `mtotacct`
  23. --
  24. CREATE TABLE IF NOT EXISTS `mtotacct` (
  25. `MTotAcctId` bigint(21) NOT NULL AUTO_INCREMENT,
  26. `UserName` varchar(64) NOT NULL DEFAULT '',
  27. `AcctDate` date NOT NULL DEFAULT '0000-00-00',
  28. `ConnNum` bigint(12) DEFAULT NULL,
  29. `ConnTotDuration` bigint(12) DEFAULT NULL,
  30. `ConnMaxDuration` bigint(12) DEFAULT NULL,
  31. `ConnMinDuration` bigint(12) DEFAULT NULL,
  32. `InputOctets` bigint(12) DEFAULT NULL,
  33. `OutputOctets` bigint(12) DEFAULT NULL,
  34. `NASIPAddress` varchar(15) DEFAULT NULL,
  35. PRIMARY KEY (`MTotAcctId`),
  36. KEY `UserName` (`UserName`),
  37. KEY `AcctDate` (`AcctDate`),
  38. KEY `UserOnDate` (`UserName`,`AcctDate`),
  39. KEY `NASIPAddress` (`NASIPAddress`)
  40. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  41. -- --------------------------------------------------------
  42. --
  43. -- Estructura de tabla para la tabla `nas`
  44. --
  45. CREATE TABLE IF NOT EXISTS `nas` (
  46. `id` int(10) NOT NULL AUTO_INCREMENT,
  47. `nasname` varchar(128) NOT NULL DEFAULT '',
  48. `shortname` varchar(32) DEFAULT NULL,
  49. `type` varchar(30) DEFAULT 'other',
  50. `ports` int(5) DEFAULT NULL,
  51. `secret` varchar(60) NOT NULL DEFAULT 'secret',
  52. `community` varchar(50) DEFAULT NULL,
  53. `description` varchar(200) DEFAULT 'RADIUS Client',
  54. `server` varchar(32) NOT NULL,
  55. `acct_enabled` tinyint(1) NOT NULL,
  56. PRIMARY KEY (`id`),
  57. KEY `nasname` (`nasname`)
  58. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  59. -- --------------------------------------------------------
  60. --
  61. -- Estructura de tabla para la tabla `radacct`
  62. --
  63. CREATE TABLE IF NOT EXISTS `radacct` (
  64. `radacctid` bigint(21) NOT NULL AUTO_INCREMENT,
  65. `acctsessionid` varchar(64) NOT NULL DEFAULT '',
  66. `acctuniqueid` varchar(32) NOT NULL DEFAULT '',
  67. `username` varchar(64) NOT NULL DEFAULT '',
  68. `groupname` varchar(64) NOT NULL DEFAULT '',
  69. `realm` varchar(64) DEFAULT '',
  70. `nasipaddress` varchar(15) NOT NULL DEFAULT '',
  71. `nasportid` varchar(15) DEFAULT NULL,
  72. `nasporttype` varchar(32) DEFAULT NULL,
  73. `acctstarttime` datetime DEFAULT NULL,
  74. `acctstoptime` datetime DEFAULT NULL,
  75. `acctsessiontime` int(12) DEFAULT NULL,
  76. `acctauthentic` varchar(32) DEFAULT NULL,
  77. `connectinfo_start` varchar(50) DEFAULT NULL,
  78. `connectinfo_stop` varchar(50) DEFAULT NULL,
  79. `acctinputoctets` bigint(20) DEFAULT NULL,
  80. `acctoutputoctets` bigint(20) DEFAULT NULL,
  81. `calledstationid` varchar(50) NOT NULL DEFAULT '',
  82. `callingstationid` varchar(50) NOT NULL DEFAULT '',
  83. `acctterminatecause` varchar(32) NOT NULL DEFAULT '',
  84. `servicetype` varchar(32) DEFAULT NULL,
  85. `framedprotocol` varchar(32) DEFAULT NULL,
  86. `framedipaddress` varchar(15) NOT NULL DEFAULT '',
  87. `acctstartdelay` int(12) DEFAULT NULL,
  88. `acctstopdelay` int(12) DEFAULT NULL,
  89. `xascendsessionsvrkey` varchar(10) DEFAULT NULL,
  90. `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  91. PRIMARY KEY (`radacctid`),
  92. KEY `username` (`username`),
  93. KEY `framedipaddress` (`framedipaddress`),
  94. KEY `acctsessionid` (`acctsessionid`),
  95. KEY `acctsessiontime` (`acctsessiontime`),
  96. KEY `acctuniqueid` (`acctuniqueid`),
  97. KEY `acctstarttime` (`acctstarttime`),
  98. KEY `acctstoptime` (`acctstoptime`),
  99. KEY `nasipaddress` (`nasipaddress`)
  100. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  101. -- --------------------------------------------------------
  102. --
  103. -- Estructura de tabla para la tabla `radcheck`
  104. --
  105. CREATE TABLE IF NOT EXISTS `radcheck` (
  106. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  107. `UserName` varbinary(64) NOT NULL DEFAULT '',
  108. `Attribute` varchar(32) NOT NULL DEFAULT '',
  109. `op` char(2) NOT NULL DEFAULT '==',
  110. `Value` varchar(253) NOT NULL DEFAULT '',
  111. PRIMARY KEY (`id`),
  112. KEY `UserName` (`UserName`(32))
  113. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=0 AUTO_INCREMENT=1 ;
  114. -- --------------------------------------------------------
  115. --
  116. -- Estructura de tabla para la tabla `radgroupcheck`
  117. --
  118. CREATE TABLE IF NOT EXISTS `radgroupcheck` (
  119. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  120. `GroupName` varchar(64) NOT NULL DEFAULT '',
  121. `Attribute` varchar(32) NOT NULL DEFAULT '',
  122. `op` char(2) NOT NULL DEFAULT '==',
  123. `Value` varchar(253) NOT NULL DEFAULT '',
  124. PRIMARY KEY (`id`),
  125. KEY `GroupName` (`GroupName`(32))
  126. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  127. -- --------------------------------------------------------
  128. --
  129. -- Estructura de tabla para la tabla `radgroupreply`
  130. --
  131. CREATE TABLE IF NOT EXISTS `radgroupreply` (
  132. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  133. `GroupName` varchar(64) NOT NULL DEFAULT '',
  134. `Attribute` varchar(32) NOT NULL DEFAULT '',
  135. `op` char(2) NOT NULL DEFAULT '=',
  136. `Value` varchar(253) NOT NULL DEFAULT '',
  137. `prio` int(10) unsigned NOT NULL DEFAULT '0',
  138. PRIMARY KEY (`id`),
  139. KEY `GroupName` (`GroupName`(32))
  140. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  141. -- --------------------------------------------------------
  142. --
  143. -- Estructura de tabla para la tabla `radpostauth`
  144. --
  145. CREATE TABLE IF NOT EXISTS `radpostauth` (
  146. `id` int(11) NOT NULL AUTO_INCREMENT,
  147. `username` varchar(64) NOT NULL DEFAULT '',
  148. `pass` varchar(64) NOT NULL DEFAULT '',
  149. `reply` varchar(32) NOT NULL DEFAULT '',
  150. `authdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  151. PRIMARY KEY (`id`)
  152. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  153. -- --------------------------------------------------------
  154. --
  155. -- Estructura de tabla para la tabla `radreply`
  156. --
  157. CREATE TABLE IF NOT EXISTS `radreply` (
  158. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  159. `UserName` varchar(64) NOT NULL DEFAULT '',
  160. `Attribute` varchar(32) NOT NULL DEFAULT '',
  161. `op` char(2) NOT NULL DEFAULT '=',
  162. `Value` varchar(253) NOT NULL DEFAULT '',
  163. PRIMARY KEY (`id`),
  164. KEY `UserName` (`UserName`(32))
  165. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  166. -- --------------------------------------------------------
  167. --
  168. -- Estructura de tabla para la tabla `radusergroup`
  169. --
  170. CREATE TABLE IF NOT EXISTS `radusergroup` (
  171. `username` varchar(64) NOT NULL DEFAULT '',
  172. `groupname` varchar(64) NOT NULL DEFAULT '',
  173. `priority` int(11) NOT NULL DEFAULT '1',
  174. KEY `username` (`username`(32))
  175. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  176. -- --------------------------------------------------------
  177. --
  178. -- Estructura de tabla para la tabla `totacct`
  179. --
  180. CREATE TABLE IF NOT EXISTS `totacct` (
  181. `TotAcctId` bigint(21) NOT NULL AUTO_INCREMENT,
  182. `UserName` varchar(64) NOT NULL DEFAULT '',
  183. `AcctDate` date NOT NULL DEFAULT '0000-00-00',
  184. `ConnNum` bigint(12) DEFAULT NULL,
  185. `ConnTotDuration` bigint(12) DEFAULT NULL,
  186. `ConnMaxDuration` bigint(12) DEFAULT NULL,
  187. `ConnMinDuration` bigint(12) DEFAULT NULL,
  188. `InputOctets` bigint(12) DEFAULT NULL,
  189. `OutputOctets` bigint(12) DEFAULT NULL,
  190. `NASIPAddress` varchar(15) DEFAULT NULL,
  191. PRIMARY KEY (`TotAcctId`),
  192. KEY `UserName` (`UserName`),
  193. KEY `AcctDate` (`AcctDate`),
  194. KEY `UserOnDate` (`UserName`,`AcctDate`),
  195. KEY `NASIPAddress` (`NASIPAddress`),
  196. KEY `NASIPAddressOnDate` (`AcctDate`,`NASIPAddress`)
  197. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  198. -- --------------------------------------------------------
  199. --
  200. -- Estructura de tabla para la tabla `usergroup`
  201. --
  202. CREATE TABLE IF NOT EXISTS `usergroup` (
  203. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  204. `UserName` varchar(64) NOT NULL DEFAULT '',
  205. `GroupName` varchar(64) NOT NULL DEFAULT '',
  206. PRIMARY KEY (`id`),
  207. KEY `UserName` (`UserName`(32))
  208. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  209. -- --------------------------------------------------------
  210. --
  211. -- Estructura de tabla para la tabla `userinfo`
  212. --
  213. CREATE TABLE IF NOT EXISTS `userinfo` (
  214. `id` int(10) NOT NULL AUTO_INCREMENT,
  215. `UserName` varchar(30) DEFAULT NULL,
  216. `Name` varchar(200) DEFAULT NULL,
  217. `Mail` varchar(200) DEFAULT NULL,
  218. `Department` varchar(200) DEFAULT NULL,
  219. `WorkPhone` varchar(200) DEFAULT NULL,
  220. `HomePhone` varchar(200) DEFAULT NULL,
  221. `Mobile` varchar(200) DEFAULT NULL,
  222. PRIMARY KEY (`id`),
  223. KEY `UserName` (`UserName`),
  224. KEY `Departmet` (`Department`)
  225. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;