::: tip 注意:

  • Mysql 5.7 +

本文档拿 Centos 8Mysql 8.0 做演示
:::

更新系统

  1. # 更新过无需更新
  2. yum -y update

安装 Mysql

  1. yum install -y @mysql

启动 Mysql

  1. systemctl start mysqld

初始化 Mysql

  1. mysql_secure_installation

mysql1

安装成功验证

  1. [root@VM-8-9-centos ~]# mysql -u root -p
  2. Enter password:
  3. Welcome to the MySQL monitor. Commands end with ; or \g.
  4. Your MySQL connection id is 16
  5. Server version: 8.0.21 Source distribution
  6. Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
  7. Oracle is a registered trademark of Oracle Corporation and/or its
  8. affiliates. Other names may be trademarks of their respective
  9. owners.
  10. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  11. mysql>

允许远程访问

  1. # 设置后方便远程管理数据库
  2. use mysql;
  3. update user set host='%' where user='root';
  4. flush privileges;

防火墙放开

  1. firewall-cmd --add-port=3306/tcp --permanent
  2. firewall-cmd --reload

命令行 导入 SQL

本方法适合没有开启远程访问的用户

  1. # 建立数据库
  2. mysql>create database w5_db;
  3. # 使用数据库
  4. mysql>use w5_db;
  5. # 设置数据库编码
  6. mysql>set names utf8mb4;
  7. # 导入数据,SQL 语句在下面(注意sql文件的路径)
  8. mysql>source /home/w5.sql;

图形 导入 SQL

本方法适合开启远程访问的用户
1.连接 Mysql
mysql2
2.创建 DB
mysql3
3.执行 SQL,SQL语句在下面 (也可以选择右键导入)
mysql4

SQL 语句

  1. -- 请使用 utf8mb4 字符集,utf8mb4_general_ci 排序规则
  2. SET NAMES utf8mb4;
  3. SET FOREIGN_KEY_CHECKS = 0;
  4. -- ----------------------------
  5. -- Table structure for w5_logs
  6. -- ----------------------------
  7. DROP TABLE IF EXISTS `w5_logs`;
  8. CREATE TABLE `w5_logs` (
  9. `id` int(11) NOT NULL AUTO_INCREMENT,
  10. `only_id` varchar(30) NOT NULL DEFAULT '',
  11. `uuid` varchar(100) NOT NULL,
  12. `app_uuid` varchar(100) NOT NULL,
  13. `app_name` varchar(20) NOT NULL DEFAULT '',
  14. `result` text NOT NULL,
  15. `status` int(2) NOT NULL DEFAULT '0',
  16. `html` text,
  17. `args` text,
  18. `create_time` datetime DEFAULT NULL,
  19. PRIMARY KEY (`id`)
  20. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  21. -- ----------------------------
  22. -- Records of w5_logs
  23. -- ----------------------------
  24. -- ----------------------------
  25. -- Table structure for `w5_report`
  26. -- ----------------------------
  27. DROP TABLE IF EXISTS `w5_report`;
  28. CREATE TABLE `w5_report` (
  29. `id` int(11) NOT NULL AUTO_INCREMENT,
  30. `report_no` varchar(30) NOT NULL DEFAULT '',
  31. `workflow_name` varchar(50) NOT NULL DEFAULT '',
  32. `remarks` varchar(255) NOT NULL DEFAULT '',
  33. `create_time` datetime DEFAULT NULL,
  34. PRIMARY KEY (`id`)
  35. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  36. CREATE TABLE `w5_timer` (
  37. `id` int(11) NOT NULL AUTO_INCREMENT,
  38. `timer_uuid` varchar(100) NOT NULL DEFAULT '',
  39. `uuid` varchar(100) NOT NULL DEFAULT '',
  40. `type` varchar(10) NOT NULL DEFAULT '',
  41. `interval_type` varchar(10) NOT NULL DEFAULT '',
  42. `time` varchar(50) NOT NULL DEFAULT '',
  43. `start_date` varchar(50) NOT NULL DEFAULT '',
  44. `end_date` varchar(50) NOT NULL DEFAULT '',
  45. `jitter` int(11) NOT NULL DEFAULT '0',
  46. `status` int(2) NOT NULL DEFAULT '0',
  47. `update_time` datetime DEFAULT NULL,
  48. `create_time` datetime DEFAULT NULL,
  49. PRIMARY KEY (`id`),
  50. UNIQUE KEY `uid` (`timer_uuid`) USING BTREE
  51. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  52. -- ----------------------------
  53. -- Table structure for w5_setting
  54. -- ----------------------------
  55. DROP TABLE IF EXISTS `w5_setting`;
  56. CREATE TABLE `w5_setting` (
  57. `id` int(11) NOT NULL AUTO_INCREMENT,
  58. `key` varchar(255) NOT NULL DEFAULT '',
  59. `value` varchar(255) NOT NULL DEFAULT '',
  60. `update_time` datetime DEFAULT NULL,
  61. `create_time` datetime DEFAULT NULL,
  62. PRIMARY KEY (`id`),
  63. UNIQUE KEY `index_key` (`key`) USING BTREE
  64. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
  65. -- ----------------------------
  66. -- Records of w5_setting
  67. -- ----------------------------
  68. BEGIN;
  69. INSERT INTO `w5_setting` VALUES (1, 'w5_key', '', '2020-12-02 21:16:15', '2020-11-29 00:32:15');
  70. INSERT INTO `w5_setting` VALUES (2, 'api_key', '', '2020-12-05 18:40:05', '2020-12-05 18:14:56');
  71. COMMIT;
  72. -- ----------------------------
  73. -- Table structure for w5_type
  74. -- ----------------------------
  75. DROP TABLE IF EXISTS `w5_type`;
  76. CREATE TABLE `w5_type` (
  77. `id` int(11) NOT NULL AUTO_INCREMENT,
  78. `type` int(2) NOT NULL DEFAULT '1',
  79. `name` varchar(20) NOT NULL DEFAULT '',
  80. `update_time` datetime DEFAULT NULL,
  81. `create_time` datetime DEFAULT NULL,
  82. PRIMARY KEY (`id`)
  83. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
  84. -- ----------------------------
  85. -- Records of w5_type
  86. -- ----------------------------
  87. BEGIN;
  88. INSERT INTO `w5_type` VALUES (1, 1, '默认剧本', '2020-12-07 11:04:07', '2020-12-07 11:04:09');
  89. INSERT INTO `w5_type` VALUES (2, 2, '默认变量', '2020-12-07 11:04:16', '2020-12-07 11:04:18');
  90. COMMIT;
  91. -- ----------------------------
  92. -- Table structure for w5_users
  93. -- ----------------------------
  94. DROP TABLE IF EXISTS `w5_users`;
  95. CREATE TABLE `w5_users` (
  96. `id` int(11) NOT NULL AUTO_INCREMENT,
  97. `account` varchar(20) NOT NULL DEFAULT '',
  98. `passwd` varchar(32) NOT NULL DEFAULT '',
  99. `nick_name` varchar(20) NOT NULL DEFAULT '',
  100. `email` varchar(50) NOT NULL DEFAULT '',
  101. `token` varchar(32) NOT NULL DEFAULT '',
  102. `status` int(11) NOT NULL DEFAULT '0',
  103. `update_time` datetime DEFAULT NULL,
  104. `create_time` datetime DEFAULT NULL,
  105. PRIMARY KEY (`id`),
  106. UNIQUE KEY `index_account` (`account`) USING BTREE
  107. ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
  108. -- ----------------------------
  109. -- Records of w5_users
  110. -- ----------------------------
  111. BEGIN;
  112. INSERT INTO `w5_users` VALUES (1, 'admin', 'F38AFA9E15326959EF26DE613E821115', 'W5', 'admin@w5.io', '178E21C9907F568647717A00D004DDC1', 0, '2020-12-07 10:11:28', '2020-12-03 13:57:45');
  113. COMMIT;
  114. -- ----------------------------
  115. -- Table structure for w5_variablen
  116. -- ----------------------------
  117. DROP TABLE IF EXISTS `w5_variablen`;
  118. CREATE TABLE `w5_variablen` (
  119. `id` int(11) NOT NULL AUTO_INCREMENT,
  120. `type_id` int(11) NOT NULL DEFAULT '0',
  121. `key` varchar(20) NOT NULL DEFAULT '',
  122. `value` varchar(255) NOT NULL DEFAULT '',
  123. `remarks` varchar(255) NOT NULL DEFAULT '',
  124. `status` int(11) NOT NULL DEFAULT '0',
  125. `update_time` datetime DEFAULT NULL,
  126. `create_time` datetime DEFAULT NULL,
  127. PRIMARY KEY (`id`),
  128. UNIQUE KEY `index.key` (`key`) USING BTREE
  129. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  130. -- ----------------------------
  131. -- Records of w5_variablen
  132. -- ----------------------------
  133. BEGIN;
  134. COMMIT;
  135. -- ----------------------------
  136. -- Table structure for w5_version
  137. -- ----------------------------
  138. DROP TABLE IF EXISTS `w5_version`;
  139. CREATE TABLE `w5_version` (
  140. `id` int(11) NOT NULL AUTO_INCREMENT,
  141. `name` varchar(255) NOT NULL DEFAULT '',
  142. `version` varchar(255) NOT NULL DEFAULT '',
  143. `update_time` datetime DEFAULT NULL,
  144. PRIMARY KEY (`id`)
  145. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
  146. -- ----------------------------
  147. -- Records of w5_version
  148. -- ----------------------------
  149. BEGIN;
  150. INSERT INTO `w5_version` VALUES (1, 'w5', '0.2', '2020-12-07 10:10:56');
  151. INSERT INTO `w5_version` VALUES (2, 'apps', '0.2', '2020-12-07 10:10:56');
  152. COMMIT;
  153. -- ----------------------------
  154. -- Table structure for w5_workflow
  155. -- ----------------------------
  156. DROP TABLE IF EXISTS `w5_workflow`;
  157. CREATE TABLE `w5_workflow` (
  158. `id` int(11) NOT NULL AUTO_INCREMENT,
  159. `uuid` varchar(100) NOT NULL DEFAULT '',
  160. `user_id` int(11) NOT NULL DEFAULT '0',
  161. `type_id` int(11) NOT NULL DEFAULT '0',
  162. `name` varchar(50) NOT NULL DEFAULT '',
  163. `remarks` varchar(255) NOT NULL DEFAULT '',
  164. `status` int(11) NOT NULL DEFAULT '0',
  165. `start_app` varchar(100) NOT NULL DEFAULT '',
  166. `end_app` varchar(100) NOT NULL DEFAULT '',
  167. `input_app` varchar(100) NOT NULL DEFAULT '',
  168. `webhook_app` varchar(100) NOT NULL DEFAULT '',
  169. `timer_app` varchar(100) NOT NULL DEFAULT '',
  170. `flow_json` text NOT NULL,
  171. `flow_data` text NOT NULL,
  172. `controller_data` text,
  173. `local_var_data` text,
  174. `update_time` datetime DEFAULT NULL,
  175. `create_time` datetime DEFAULT NULL,
  176. PRIMARY KEY (`id`),
  177. UNIQUE KEY `index_uuid` (`uuid`) USING BTREE
  178. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  179. -- ----------------------------
  180. -- Records of w5_workflow
  181. -- ----------------------------
  182. BEGIN;
  183. COMMIT;
  184. SET FOREIGN_KEY_CHECKS = 1;