├── LICENSE
├── README.md
├── README.md~
├── ajax.html
├── base_config.html
├── cgi-bin
├── base_config.c
├── base_config.cgi
├── cgic.c
├── cgic.h
├── config_info.c
├── config_sql.c
├── config编译说明.txt
├── get.c
├── get.cgi
├── getdata.c
├── ifconfig.c
├── login.c
├── login.cgi
├── person.db
├── register.c
├── register.cgi
├── sql.c
├── sql.h
├── sqlite3.c
├── sqlite3.h
├── upload.c
├── upload.cgi
└── upload2.c
├── css
├── bootstrap-grid.css
├── bootstrap-grid.css.map
├── bootstrap-grid.min.css
├── bootstrap-grid.min.css.map
├── bootstrap-reboot.css
├── bootstrap-reboot.css.map
├── bootstrap-reboot.min.css
├── bootstrap-reboot.min.css.map
├── bootstrap.css
├── bootstrap.css.map
├── bootstrap.min.css
├── bootstrap.min.css.map
├── config.css
├── jquery-ui.min.css
├── login.css
└── register.css
├── img
├── config_bg.jpg
├── login_bg.jpg
├── login_head.jpg
├── login_head.png
└── register_head.png
├── js
├── bootstrap.bundle.js
├── bootstrap.bundle.js.map
├── bootstrap.bundle.min.js
├── bootstrap.bundle.min.js.map
├── bootstrap.js
├── bootstrap.js.map
├── bootstrap.min.js
├── bootstrap.min.js.map
├── jquery-2.2.3.min.js
├── jquery-ui.min.js
└── my.js
├── login.html
├── register.html
├── upload.html
└── 环境搭建参考
├── apache.txt
├── boa-0.94.13.tar.gz
├── boa-0.94.13.zip
├── boa.conf
├── ccgi.txt
├── cgic207.tar.gz
├── mime.types
└── 相关链接.txt
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## 前言
2 |
3 | 效果参考:
4 |
5 | https://ikaros-521.gitee.io/boa_cgi_html_mysql/login.html
6 |
7 | 使用到的软件和技术
8 |
9 | BOA服务器,CGI,CCGI,MySQL,SQLite。C,HTML,CSS,JS,SQL
10 |
11 | 具体功能讲解
12 |
13 | 1、运行BOA服务器 (来到BOA目录下的src,终端输入 sudo ./boa 启动服务)
14 |
15 | 2、打开浏览器,输入localhost:端口号/login.html (文件都要放在 /var/www 目录下)
16 |
17 | 3、登录页面,注册页面。(登录注册将表单发送给对应CGI文件,CGI文件和MySQL数据库交互(运行MySQL,建好数据库和表),将结果输出)
18 |
19 | 4、登录成功后会来到 配置页面。(对相应参数进行配置,可自由发挥,同样HTML的表单发送给CGI程序,打开系统文件,写入相应参数,重启服务)
20 |
21 | 环境搭建和配置等其他问题可以参考大佬的博客讲解 [https://blog.csdn.net/A642960662/article/details/66473793](https://blog.csdn.net/A642960662/article/details/66473793)
22 |
23 | ajax局部刷新,这个demo链接在这 [https://gitee.com/ikaros-521/ajax_cgi/tree/master](https://gitee.com/ikaros-521/ajax_cgi/tree/master)
24 |
25 | 由于本工程当时是在刚接触Boa不久就编写的,所以比较混乱,如果希望有个清晰点的demo工程进行参考,可以参考我的新文章:[Linux下 基于Boa的应用资源管理系统 SMS](https://ikaros.blog.csdn.net/article/details/121848899),新工程的地址 [https://github.com/Ikaros-521/boa_cgi_SMS](https://github.com/Ikaros-521/boa_cgi_SMS)
26 |
27 | ## 准备环境
28 |
29 | 操作系统: Ubuntu12.04 LTS
30 |
31 | 环境搭建: 需要 [BOA](http://www.boa.org/),CCGI,MySQL,GCC
32 |
33 | [Linux下嵌入式Web服务器BOA和CGI编程开发](https://blog.csdn.net/Ikaros_521/article/details/102610768)
34 |
35 | [数据库的相关知识——学习笔记](https://blog.csdn.net/Ikaros_521/article/details/102610768) 的三
36 |
37 | [mysql中文乱码问题解决 / C程序插入仍是乱码解决 / 卸载重装教学](https://blog.csdn.net/Ikaros_521/article/details/102664117)
38 |
39 | 扩展: 我还用了[bootstrap](https://www.runoob.com/bootstrap/bootstrap-tutorial.html)框架,CSS/JS
40 |
41 | 源码链接:GitHub:[传送门](https://github.com/Ikaros-521/boa_cgi_html_mysql) , 码云:[传送门](https://gitee.com/ikaros-521/boa_cgi_html_mysql)
42 |
43 | ## 使用方法
44 |
45 | 环境准备好后,我们在 /var/www 下写HTML文件
46 |
47 | 
48 |
49 | 在 /var/www/cgi-bin 下写c文件,编译后命名为.cgi。
50 |
51 | 编译命令仅供参考
52 |
53 | `gcc -o login.cgi login.c cgic.c -lpthread -ldl -lmysqlclient`
54 |
55 | 
56 |
57 | 程序都写好后,我们开始测试。
58 |
59 |
60 | **1、开启MySQL服务 默认开启**
61 |
62 | 
63 |
64 | 我的程序需要事先 新建用户test,数据库register,表user
65 |
66 | ```bash
67 | mysql -utest -ptest
68 | ```
69 |
70 | ```sql
71 | // 创建新用户test
72 | mysql> create user 'test'@'localhost' identified by 'test';
73 | // 给test用户所有权限
74 | mysql> grant all privileges on *.* to test@localhost identified by 'test';
75 | // 刷新权限
76 | mysql> flush privileges;
77 | ```
78 |
79 | ```sql
80 | mysql> create database register;
81 | ```
82 |
83 | ```sql
84 | mysql> use register;
85 | mysql> CREATE TABLE user(username varchar(20) PRIMARY KEY,password varchar(20));
86 | ```
87 |
88 | **2、开启BOA服务器,在/boa/src目录下** `sudo ./boa`
89 |
90 | 
91 |
92 | **3、打开浏览器,访问localhost:端口号 访问的即 /var/www 目录**
93 |
94 | **我直接访问 http://localhost:886/login.html 我的登录页面**
95 |
96 | 
97 |
98 | 其他页面都是同理。
99 |
100 | ## 思路讲解
101 |
102 | 
103 |
104 | **开启boa服务器后,我们访问到我们在 /var/www 下编写的HTML文件,显示我们的登录页面。
105 | 我们点击“注册”按钮,跳转到 register.html**
106 |
107 | 
108 |
109 | **点击“注册”按钮,提交form表单信息给cgi-bin/register.cgi**
110 |
111 | 
112 |
113 | **cgi程序通过 cgiFormString函数试图检索发送给指定字段的字符串。存入变量中。我们连接MySQL数据库**
114 |
115 | 
116 |
117 | 
118 |
119 | **将数据写入register数据库中的user表中(此数据库和表需要先建好)**
120 |
121 | 
122 |
123 | **处理完毕后,跳回 login.html 登录页面**
124 |
125 | 
126 |
127 | 
128 |
129 | **现在我们输入数据,点击“登录”,同理将表单发给 login.cgi ,对数据在MySQL数据库中查询后,成功就来到base_config.html 配置页面。**
130 |
131 | 
132 |
133 | **然后我们输入相应数据,点击“提交”,交给base_config.cgi处理,之后任意发挥就好了。**
134 |
135 | 
136 |
137 | **我是打印出来,写入系统文件的代码暂时注释了,慎用**
138 |
139 | 
140 |
141 | *遇到问题可以参考页首的链接*
142 |
143 | ---
144 |
145 |
146 | **其余参考[GitHub](https://github.com/Ikaros-521/boa_cgi_html_mysql)或[码云](https://gitee.com/ikaros-521/boa_cgi_html_mysql)**
147 |
148 | ## 补充
149 | ### 文件上传
150 | 前端post方式上传文件到后端 /var/www/cgi-bin 目录下
151 | 
152 | 
153 | 
154 |
--------------------------------------------------------------------------------
/README.md~:
--------------------------------------------------------------------------------
1 | 使用到的软件和技术
2 | BOA服务器,Apache,CGI,CCGI,MySQL,SQLite。C,HTML,CSS,JS,SQL
3 | 具体功能讲解
4 | 1、运行BOA服务器 (来到BOA目录下的src,终端输入 sudo ./boa 启动服务)
5 | 2、打开浏览器,输入localhost:端口号/login.html (文件都要放在 /var/www 目录下)
6 | 3、登录页面,注册页面。(登录注册将表单发送给对应CGI文件,CGI文件和MySQL数据库交互(运行MySQL,建好数据库和表),将结果输出)
7 | 4、登录成功后会来到 配置页面。(对相应参数进行配置,可自由发挥,同样HTML的表单发送给CGI程序,打开系统文件,写入相应参数,重启服务)
8 | 环境搭建和配置等其他问题可以参考大佬的博客讲解
9 | https://blog.csdn.net/A642960662/article/details/66473793
10 |
--------------------------------------------------------------------------------
/ajax.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
\n\n");
122 |
123 | //printf("\n");
124 |
125 | return 0;
126 | }
127 |
--------------------------------------------------------------------------------
/cgi-bin/base_config.cgi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ikaros-521/boa_cgi_html_mysql/9b6a309ceca109ce802041f45e6f25aa1075d211/cgi-bin/base_config.cgi
--------------------------------------------------------------------------------
/cgi-bin/cgic.h:
--------------------------------------------------------------------------------
1 | /* The CGI_C library, by Thomas Boutell, version 2.01. CGI_C is intended
2 | to be a high-quality API to simplify CGI programming tasks. */
3 |
4 | /* Make sure this is only included once. */
5 |
6 | #ifndef CGI_C
7 | #define CGI_C 1
8 |
9 | /* Bring in standard I/O since some of the functions refer to
10 | types defined by it, such as FILE *. */
11 |
12 | #include
13 |
14 | /* The various CGI environment variables. Instead of using getenv(),
15 | the programmer should refer to these, which are always
16 | valid null-terminated strings (they may be empty, but they
17 | will never be null). If these variables are used instead
18 | of calling getenv(), then it will be possible to save
19 | and restore CGI environments, which is highly convenient
20 | for debugging. */
21 |
22 | extern char *cgiServerSoftware;
23 | extern char *cgiServerName;
24 | extern char *cgiGatewayInterface;
25 | extern char *cgiServerProtocol;
26 | extern char *cgiServerPort;
27 | extern char *cgiRequestMethod;
28 | extern char *cgiPathInfo;
29 | extern char *cgiPathTranslated;
30 | extern char *cgiScriptName;
31 | extern char *cgiQueryString;
32 | extern char *cgiRemoteHost;
33 | extern char *cgiRemoteAddr;
34 | extern char *cgiAuthType;
35 | extern char *cgiRemoteUser;
36 | extern char *cgiRemoteIdent;
37 | extern char *cgiContentType;
38 | extern char *cgiAccept;
39 | extern char *cgiUserAgent;
40 | extern char *cgiReferrer;
41 |
42 | /* Cookies as sent to the server. You can also get them
43 | individually, or as a string array; see the documentation. */
44 | extern char *cgiCookie;
45 |
46 | /* A macro providing the same incorrect spelling that is
47 | found in the HTTP/CGI specifications */
48 | #define cgiReferer cgiReferrer
49 |
50 | /* The number of bytes of data received.
51 | Note that if the submission is a form submission
52 | the library will read and parse all the information
53 | directly from cgiIn; the programmer need not do so. */
54 |
55 | extern int cgiContentLength;
56 |
57 | /* Pointer to CGI output. The cgiHeader functions should be used
58 | first to output the mime headers; the output HTML
59 | page, GIF image or other web document should then be written
60 | to cgiOut by the programmer. In the standard CGIC library,
61 | cgiOut is always equivalent to stdout. */
62 |
63 | extern FILE *cgiOut;
64 |
65 | /* Pointer to CGI input. The programmer does not read from this.
66 | We have continued to export it for backwards compatibility
67 | so that cgic 1.x applications link properly. */
68 |
69 | extern FILE *cgiIn;
70 |
71 | /* Possible return codes from the cgiForm family of functions (see below). */
72 |
73 | typedef enum {
74 | cgiFormSuccess,
75 | cgiFormTruncated,
76 | cgiFormBadType,
77 | cgiFormEmpty,
78 | cgiFormNotFound,
79 | cgiFormConstrained,
80 | cgiFormNoSuchChoice,
81 | cgiFormMemory,
82 | cgiFormNoFileName,
83 | cgiFormNoContentType,
84 | cgiFormNotAFile,
85 | cgiFormOpenFailed,
86 | cgiFormIO,
87 | cgiFormEOF
88 | } cgiFormResultType;
89 |
90 | /* These functions are used to retrieve form data. See
91 | cgic.html for documentation. */
92 |
93 | extern cgiFormResultType cgiFormString(
94 | char *name, char *result, int max);
95 |
96 | extern cgiFormResultType cgiFormStringNoNewlines(
97 | char *name, char *result, int max);
98 |
99 |
100 | extern cgiFormResultType cgiFormStringSpaceNeeded(
101 | char *name, int *length);
102 |
103 |
104 | extern cgiFormResultType cgiFormStringMultiple(
105 | char *name, char ***ptrToStringArray);
106 |
107 | extern void cgiStringArrayFree(char **stringArray);
108 |
109 | extern cgiFormResultType cgiFormInteger(
110 | char *name, int *result, int defaultV);
111 |
112 | extern cgiFormResultType cgiFormIntegerBounded(
113 | char *name, int *result, int min, int max, int defaultV);
114 |
115 | extern cgiFormResultType cgiFormDouble(
116 | char *name, double *result, double defaultV);
117 |
118 | extern cgiFormResultType cgiFormDoubleBounded(
119 | char *name, double *result, double min, double max, double defaultV);
120 |
121 | extern cgiFormResultType cgiFormSelectSingle(
122 | char *name, char **choicesText, int choicesTotal,
123 | int *result, int defaultV);
124 |
125 |
126 | extern cgiFormResultType cgiFormSelectMultiple(
127 | char *name, char **choicesText, int choicesTotal,
128 | int *result, int *invalid);
129 |
130 | /* Just an alias; users have asked for this */
131 | #define cgiFormSubmitClicked cgiFormCheckboxSingle
132 |
133 | extern cgiFormResultType cgiFormCheckboxSingle(
134 | char *name);
135 |
136 | extern cgiFormResultType cgiFormCheckboxMultiple(
137 | char *name, char **valuesText, int valuesTotal,
138 | int *result, int *invalid);
139 |
140 | extern cgiFormResultType cgiFormRadio(
141 | char *name, char **valuesText, int valuesTotal,
142 | int *result, int defaultV);
143 |
144 | /* The paths returned by this function are the original names of files
145 | as reported by the uploading web browser and shoult NOT be
146 | blindly assumed to be "safe" names for server-side use! */
147 | extern cgiFormResultType cgiFormFileName(
148 | char *name, char *result, int max);
149 |
150 | /* The content type of the uploaded file, as reported by the browser.
151 | It should NOT be assumed that browsers will never falsify
152 | such information. */
153 | extern cgiFormResultType cgiFormFileContentType(
154 | char *name, char *result, int max);
155 |
156 | extern cgiFormResultType cgiFormFileSize(
157 | char *name, int *sizeP);
158 |
159 | typedef struct cgiFileStruct *cgiFilePtr;
160 |
161 | extern cgiFormResultType cgiFormFileOpen(
162 | char *name, cgiFilePtr *cfpp);
163 |
164 | extern cgiFormResultType cgiFormFileRead(
165 | cgiFilePtr cfp, char *buffer, int bufferSize, int *gotP);
166 |
167 | extern cgiFormResultType cgiFormFileClose(
168 | cgiFilePtr cfp);
169 |
170 | extern cgiFormResultType cgiCookieString(
171 | char *name, char *result, int max);
172 |
173 | extern cgiFormResultType cgiCookieInteger(
174 | char *name, int *result, int defaultV);
175 |
176 | cgiFormResultType cgiCookies(
177 | char ***ptrToStringArray);
178 |
179 | /* path can be null or empty in which case a path of / (entire site) is set.
180 | domain can be a single web site; if it is an entire domain, such as
181 | 'boutell.com', it should begin with a dot: '.boutell.com' */
182 | extern void cgiHeaderCookieSetString(char *name, char *value,
183 | int secondsToLive, char *path, char *domain);
184 | extern void cgiHeaderCookieSetInteger(char *name, int value,
185 | int secondsToLive, char *path, char *domain);
186 | extern void cgiHeaderLocation(char *redirectUrl);
187 | extern void cgiHeaderStatus(int status, char *statusMessage);
188 | extern void cgiHeaderContentType(char *mimeType);
189 |
190 | typedef enum {
191 | cgiEnvironmentIO,
192 | cgiEnvironmentMemory,
193 | cgiEnvironmentSuccess,
194 | cgiEnvironmentWrongVersion
195 | } cgiEnvironmentResultType;
196 |
197 | extern cgiEnvironmentResultType cgiWriteEnvironment(char *filename);
198 | extern cgiEnvironmentResultType cgiReadEnvironment(char *filename);
199 |
200 | extern int cgiMain();
201 |
202 | extern cgiFormResultType cgiFormEntries(
203 | char ***ptrToStringArray);
204 |
205 | /* Output string with the <, &, and > characters HTML-escaped.
206 | 's' is null-terminated. Returns cgiFormIO in the event
207 | of error, cgiFormSuccess otherwise. */
208 | cgiFormResultType cgiHtmlEscape(const char *s);
209 |
210 | /* Output data with the <, &, and > characters HTML-escaped.
211 | 'data' is not null-terminated; 'len' is the number of
212 | bytes in 'data'. Returns cgiFormIO in the event
213 | of error, cgiFormSuccess otherwise. */
214 | cgiFormResultType cgiHtmlEscapeData(const char *data, int len);
215 |
216 | /* Output string with the " character HTML-escaped, and no
217 | other characters escaped. This is useful when outputting
218 | the contents of a tag attribute such as 'href' or 'src'.
219 | 's' is null-terminated. Returns cgiFormIO in the event
220 | of error, cgiFormSuccess otherwise. */
221 | cgiFormResultType cgiValueEscape(const char *s);
222 |
223 | /* Output data with the " character HTML-escaped, and no
224 | other characters escaped. This is useful when outputting
225 | the contents of a tag attribute such as 'href' or 'src'.
226 | 'data' is not null-terminated; 'len' is the number of
227 | bytes in 'data'. Returns cgiFormIO in the event
228 | of error, cgiFormSuccess otherwise. */
229 | cgiFormResultType cgiValueEscapeData(const char *data, int len);
230 |
231 | #endif /* CGI_C */
232 |
233 |
--------------------------------------------------------------------------------
/cgi-bin/config_info.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include "cgic.h"
8 | #include "sqlite3.h"
9 | #define SQL_SIZE 256
10 | int cgiMain(int argc, char **argv)
11 | {
12 | char name[64];
13 | char age[4];
14 | char sex[8];
15 | char company[64];
16 | char profession[16];
17 | char idnumber[24];
18 | char qq[24];
19 | char email[64];
20 | char telephone[16];//回显信息到HTML网页cgiHeaderContentType("text/html");
21 | printf("\n\n");
22 | printf("
` elements.\n\nbody {\n margin: 0; // 1\n font-family: $font-family-base;\n @include font-size($font-size-base);\n font-weight: $font-weight-base;\n line-height: $line-height-base;\n color: $body-color;\n text-align: left; // 3\n background-color: $body-bg; // 2\n}\n\n// Suppress the focus outline on elements that cannot be accessed via keyboard.\n// This prevents an unwanted focus outline from appearing around elements that\n// might still respond to pointer events.\n//\n// Credit: https://github.com/suitcss/base\n[tabindex=\"-1\"]:focus {\n outline: 0 !important;\n}\n\n\n// Content grouping\n//\n// 1. Add the correct box sizing in Firefox.\n// 2. Show the overflow in Edge and IE.\n\nhr {\n box-sizing: content-box; // 1\n height: 0; // 1\n overflow: visible; // 2\n}\n\n\n//\n// Typography\n//\n\n// Remove top margins from headings\n//\n// By default, `
`-`
` all receive top and bottom margins. We nuke the top\n// margin for easier control within type scales as it avoids margin collapsing.\n// stylelint-disable-next-line selector-list-comma-newline-after\nh1, h2, h3, h4, h5, h6 {\n margin-top: 0;\n margin-bottom: $headings-margin-bottom;\n}\n\n// Reset margins on paragraphs\n//\n// Similarly, the top margin on `
`s get reset. However, we also reset the\n// bottom margin to use `rem` units instead of `em`.\np {\n margin-top: 0;\n margin-bottom: $paragraph-margin-bottom;\n}\n\n// Abbreviations\n//\n// 1. Duplicate behavior to the data-* attribute for our tooltip plugin\n// 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n// 3. Add explicit cursor to indicate changed behavior.\n// 4. Remove the bottom border in Firefox 39-.\n// 5. Prevent the text-decoration to be skipped.\n\nabbr[title],\nabbr[data-original-title] { // 1\n text-decoration: underline; // 2\n text-decoration: underline dotted; // 2\n cursor: help; // 3\n border-bottom: 0; // 4\n text-decoration-skip-ink: none; // 5\n}\n\naddress {\n margin-bottom: 1rem;\n font-style: normal;\n line-height: inherit;\n}\n\nol,\nul,\ndl {\n margin-top: 0;\n margin-bottom: 1rem;\n}\n\nol ol,\nul ul,\nol ul,\nul ol {\n margin-bottom: 0;\n}\n\ndt {\n font-weight: $dt-font-weight;\n}\n\ndd {\n margin-bottom: .5rem;\n margin-left: 0; // Undo browser default\n}\n\nblockquote {\n margin: 0 0 1rem;\n}\n\nb,\nstrong {\n font-weight: $font-weight-bolder; // Add the correct font weight in Chrome, Edge, and Safari\n}\n\nsmall {\n @include font-size(80%); // Add the correct font size in all browsers\n}\n\n//\n// Prevent `sub` and `sup` elements from affecting the line height in\n// all browsers.\n//\n\nsub,\nsup {\n position: relative;\n @include font-size(75%);\n line-height: 0;\n vertical-align: baseline;\n}\n\nsub { bottom: -.25em; }\nsup { top: -.5em; }\n\n\n//\n// Links\n//\n\na {\n color: $link-color;\n text-decoration: $link-decoration;\n background-color: transparent; // Remove the gray background on active links in IE 10.\n\n @include hover {\n color: $link-hover-color;\n text-decoration: $link-hover-decoration;\n }\n}\n\n// And undo these styles for placeholder links/named anchors (without href)\n// which have not been made explicitly keyboard-focusable (without tabindex).\n// It would be more straightforward to just use a[href] in previous block, but that\n// causes specificity issues in many other styles that are too complex to fix.\n// See https://github.com/twbs/bootstrap/issues/19402\n\na:not([href]):not([tabindex]) {\n color: inherit;\n text-decoration: none;\n\n @include hover-focus {\n color: inherit;\n text-decoration: none;\n }\n\n &:focus {\n outline: 0;\n }\n}\n\n\n//\n// Code\n//\n\npre,\ncode,\nkbd,\nsamp {\n font-family: $font-family-monospace;\n @include font-size(1em); // Correct the odd `em` font sizing in all browsers.\n}\n\npre {\n // Remove browser default top margin\n margin-top: 0;\n // Reset browser default of `1em` to use `rem`s\n margin-bottom: 1rem;\n // Don't allow content to break outside\n overflow: auto;\n}\n\n\n//\n// Figures\n//\n\nfigure {\n // Apply a consistent margin strategy (matches our type styles).\n margin: 0 0 1rem;\n}\n\n\n//\n// Images and content\n//\n\nimg {\n vertical-align: middle;\n border-style: none; // Remove the border on images inside links in IE 10-.\n}\n\nsvg {\n // Workaround for the SVG overflow bug in IE10/11 is still required.\n // See https://github.com/twbs/bootstrap/issues/26878\n overflow: hidden;\n vertical-align: middle;\n}\n\n\n//\n// Tables\n//\n\ntable {\n border-collapse: collapse; // Prevent double borders\n}\n\ncaption {\n padding-top: $table-cell-padding;\n padding-bottom: $table-cell-padding;\n color: $table-caption-color;\n text-align: left;\n caption-side: bottom;\n}\n\nth {\n // Matches default `
` alignment by inheriting from the ``, or the\n // closest parent with a set `text-align`.\n text-align: inherit;\n}\n\n\n//\n// Forms\n//\n\nlabel {\n // Allow labels to use `margin` for spacing.\n display: inline-block;\n margin-bottom: $label-margin-bottom;\n}\n\n// Remove the default `border-radius` that macOS Chrome adds.\n//\n// Details at https://github.com/twbs/bootstrap/issues/24093\nbutton {\n // stylelint-disable-next-line property-blacklist\n border-radius: 0;\n}\n\n// Work around a Firefox/IE bug where the transparent `button` background\n// results in a loss of the default `button` focus styles.\n//\n// Credit: https://github.com/suitcss/base/\nbutton:focus {\n outline: 1px dotted;\n outline: 5px auto -webkit-focus-ring-color;\n}\n\ninput,\nbutton,\nselect,\noptgroup,\ntextarea {\n margin: 0; // Remove the margin in Firefox and Safari\n font-family: inherit;\n @include font-size(inherit);\n line-height: inherit;\n}\n\nbutton,\ninput {\n overflow: visible; // Show the overflow in Edge\n}\n\nbutton,\nselect {\n text-transform: none; // Remove the inheritance of text transform in Firefox\n}\n\n// Remove the inheritance of word-wrap in Safari.\n//\n// Details at https://github.com/twbs/bootstrap/issues/24990\nselect {\n word-wrap: normal;\n}\n\n\n// 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`\n// controls in Android 4.\n// 2. Correct the inability to style clickable types in iOS and Safari.\nbutton,\n[type=\"button\"], // 1\n[type=\"reset\"],\n[type=\"submit\"] {\n -webkit-appearance: button; // 2\n}\n\n// Opinionated: add \"hand\" cursor to non-disabled button elements.\n@if $enable-pointer-cursor-for-buttons {\n button,\n [type=\"button\"],\n [type=\"reset\"],\n [type=\"submit\"] {\n &:not(:disabled) {\n cursor: pointer;\n }\n }\n}\n\n// Remove inner border and padding from Firefox, but don't restore the outline like Normalize.\nbutton::-moz-focus-inner,\n[type=\"button\"]::-moz-focus-inner,\n[type=\"reset\"]::-moz-focus-inner,\n[type=\"submit\"]::-moz-focus-inner {\n padding: 0;\n border-style: none;\n}\n\ninput[type=\"radio\"],\ninput[type=\"checkbox\"] {\n box-sizing: border-box; // 1. Add the correct box sizing in IE 10-\n padding: 0; // 2. Remove the padding in IE 10-\n}\n\n\ninput[type=\"date\"],\ninput[type=\"time\"],\ninput[type=\"datetime-local\"],\ninput[type=\"month\"] {\n // Remove the default appearance of temporal inputs to avoid a Mobile Safari\n // bug where setting a custom line-height prevents text from being vertically\n // centered within the input.\n // See https://bugs.webkit.org/show_bug.cgi?id=139848\n // and https://github.com/twbs/bootstrap/issues/11266\n -webkit-appearance: listbox;\n}\n\ntextarea {\n overflow: auto; // Remove the default vertical scrollbar in IE.\n // Textareas should really only resize vertically so they don't break their (horizontal) containers.\n resize: vertical;\n}\n\nfieldset {\n // Browsers set a default `min-width: min-content;` on fieldsets,\n // unlike e.g. `
65 |
77 |
78 |
--------------------------------------------------------------------------------
/环境搭建参考/apache.txt:
--------------------------------------------------------------------------------
1 | sudo apt-get install apache2
2 |
--------------------------------------------------------------------------------
/环境搭建参考/boa-0.94.13.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ikaros-521/boa_cgi_html_mysql/9b6a309ceca109ce802041f45e6f25aa1075d211/环境搭建参考/boa-0.94.13.tar.gz
--------------------------------------------------------------------------------
/环境搭建参考/boa-0.94.13.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ikaros-521/boa_cgi_html_mysql/9b6a309ceca109ce802041f45e6f25aa1075d211/环境搭建参考/boa-0.94.13.zip
--------------------------------------------------------------------------------
/环境搭建参考/boa.conf:
--------------------------------------------------------------------------------
1 | # cumentRoot /var/www
2 | #将cgi保存的实际位置和网站地址做个对应
3 | # ScriptAlias /cgi-bin/ /var/www/cgi-bin/
4 | #cgi脚本运行时能看到的$PATH(可选)
5 | # CGIPath /bin:/usr/bin:/usr/local/bin
6 | #如果想在任何位置都能运行cgi,要添加这个(可选)
7 | AddType application/x-httpd-cgi cgi
8 | # Boa v0.94 configuration file
9 | # File format has not changed from 0.93
10 | # File format has changed little from 0.92
11 | # version changes are noted in the comments
12 | #
13 | # The Boa configuration file is parsed with a lex/yacc or flex/bison
14 | # generated parser. If it reports an error, the line number will be
15 | # provided; it should be easy to spot. The syntax of each of these
16 | # rules is very simple, and they can occur in any order. Where possible
17 | # these directives mimic those of NCSA httpd 1.3; I saw no reason to
18 | # introduce gratuitous differences.
19 |
20 | # $Id: boa.conf,v 1.25 2002/03/22 04:33:09 jnelson Exp $
21 |
22 | # The "ServerRoot" is not in this configuration file. It can be compiled
23 | # into the server (see defines.h) or specified on the command line with
24 | # the -c option, for example:
25 | #
26 | # boa -c /usr/local/boa
27 |
28 |
29 | # Port: The port Boa runs on. The default port for http servers is 80.
30 | # If it is less than 1024, the server must be started as root.
31 |
32 | Port 886
33 |
34 | # Listen: the Internet address to bind(2) to. If you leave it out,
35 | # it takes the behavior before 0.93.17.2, which is to bind to all
36 | # addresses (INADDR_ANY). You only get one "Listen" directive,
37 | # if you want service on multiple IP addresses, you have three choices:
38 | # 1. Run boa without a "Listen" directive
39 | # a. All addresses are treated the same; makes sense if the addresses
40 | # are localhost, ppp, and eth0.
41 | # b. Use the VirtualHost directive below to point requests to different
42 | # files. Should be good for a very large number of addresses (web
43 | # hosting clients).
44 | # 2. Run one copy of boa per IP address, each has its own configuration
45 | # with a "Listen" directive. No big deal up to a few tens of addresses.
46 | # Nice separation between clients.
47 | # The name you provide gets run through inet_aton(3), so you have to use dotted
48 | # quad notation. This configuration is too important to trust some DNS.
49 |
50 | #Listen 192.68.0.5
51 |
52 | # User: The name or UID the server should run as.
53 | # Group: The group name or GID the server should run as.
54 |
55 | User root
56 | Group root
57 |
58 | # ServerAdmin: The email address where server problems should be sent.
59 | # Note: this is not currently used, except as an environment variable
60 | # for CGIs.
61 |
62 | #ServerAdmin root@localhost
63 |
64 | # ErrorLog: The location of the error log file. If this does not start
65 | # with /, it is considered relative to the server root.
66 | # Set to /dev/null if you don't want errors logged.
67 | # If unset, defaults to /dev/stderr
68 |
69 | ErrorLog /var/log/boa/error_log
70 | # Please NOTE: Sending the logs to a pipe ('|'), as shown below,
71 | # is somewhat experimental and might fail under heavy load.
72 | # "Usual libc implementations of printf will stall the whole
73 | # process if the receiving end of a pipe stops reading."
74 | #ErrorLog "|/usr/sbin/cronolog --symlink=/var/log/boa/error_log /var/log/boa/error-%Y%m%d.log"
75 |
76 | # AccessLog: The location of the access log file. If this does not
77 | # start with /, it is considered relative to the server root.
78 | # Comment out or set to /dev/null (less effective) to disable
79 | # Access logging.
80 |
81 |
82 | # AccessLog /var/log/boa/access_log
83 |
84 |
85 | # Please NOTE: Sending the logs to a pipe ('|'), as shown below,
86 | # is somewhat experimental and might fail under heavy load.
87 | # "Usual libc implementations of printf will stall the whole
88 | # process if the receiving end of a pipe stops reading."
89 | #AccessLog "|/usr/sbin/cronolog --symlink=/var/log/boa/access_log /var/log/boa/access-%Y%m%d.log"
90 |
91 | # UseLocaltime: Logical switch. Uncomment to use localtime
92 | # instead of UTC time
93 | #UseLocaltime
94 |
95 | # VerboseCGILogs: this is just a logical switch.
96 | # It simply notes the start and stop times of cgis in the error log
97 | # Comment out to disable.
98 |
99 | #VerboseCGILogs
100 |
101 | # ServerName: the name of this server that should be sent back to
102 | # clients if different than that returned by gethostname + gethostbyname
103 |
104 | ServerName www.your.org.here
105 |
106 | # VirtualHost: a logical switch.
107 | # Comment out to disable.
108 | # Given DocumentRoot /var/www, requests on interface 'A' or IP 'IP-A'
109 | # become /var/www/IP-A.
110 | # Example: http://localhost/ becomes /var/www/127.0.0.1
111 | #
112 | # Not used until version 0.93.17.2. This "feature" also breaks commonlog
113 | # output rules, it prepends the interface number to each access_log line.
114 | # You are expected to fix that problem with a postprocessing script.
115 |
116 | #VirtualHost
117 |
118 | # DocumentRoot: The root directory of the HTML documents.
119 | # Comment out to disable server non user files.
120 |
121 | DocumentRoot /var/www
122 |
123 | # UserDir: The name of the directory which is appended onto a user's home
124 | # directory if a ~user request is recieved.
125 |
126 | UserDir public_html
127 |
128 | # DirectoryIndex: Name of the file to use as a pre-written HTML
129 | # directory index. Please MAKE AND USE THESE FILES. On the
130 | # fly creation of directory indexes can be _slow_.
131 | # Comment out to always use DirectoryMaker
132 |
133 | DirectoryIndex index.html
134 |
135 | # DirectoryMaker: Name of program used to create a directory listing.
136 | # Comment out to disable directory listings. If both this and
137 | # DirectoryIndex are commented out, accessing a directory will give
138 | # an error (though accessing files in the directory are still ok).
139 |
140 | DirectoryMaker /usr/lib/boa/boa_indexer
141 |
142 | # DirectoryCache: If DirectoryIndex doesn't exist, and DirectoryMaker
143 | # has been commented out, the the on-the-fly indexing of Boa can be used
144 | # to generate indexes of directories. Be warned that the output is
145 | # extremely minimal and can cause delays when slow disks are used.
146 | # Note: The DirectoryCache must be writable by the same user/group that
147 | # Boa runs as.
148 |
149 | # DirectoryCache /var/spool/boa/dircache
150 |
151 | # KeepAliveMax: Number of KeepAlive requests to allow per connection
152 | # Comment out, or set to 0 to disable keepalive processing
153 |
154 | KeepAliveMax 1000
155 |
156 | # KeepAliveTimeout: seconds to wait before keepalive connection times out
157 |
158 | KeepAliveTimeout 10
159 |
160 | # MimeTypes: This is the file that is used to generate mime type pairs
161 | # and Content-Type fields for boa.
162 | # Set to /dev/null if you do not want to load a mime types file.
163 | # Do *not* comment out (better use AddType!)
164 |
165 | MimeTypes /etc/mime.types
166 |
167 | # DefaultType: MIME type used if the file extension is unknown, or there
168 | # is no file extension.
169 |
170 | DefaultType text/plain
171 |
172 | # CGIPath: The value of the $PATH environment variable given to CGI progs.
173 |
174 | CGIPath /bin:/usr/bin:/usr/local/bin
175 |
176 | # SinglePostLimit: The maximum allowable number of bytes in
177 | # a single POST. Default is normally 1MB.
178 |
179 | # AddType: adds types without editing mime.types
180 | # Example: AddType type extension [extension ...]
181 |
182 | # Uncomment the next line if you want .cgi files to execute from anywhere
183 | #AddType application/x-httpd-cgi cgi
184 |
185 | # Redirect, Alias, and ScriptAlias all have the same semantics -- they
186 | # match the beginning of a request and take appropriate action. Use
187 | # Redirect for other servers, Alias for the same server, and ScriptAlias
188 | # to enable directories for script execution.
189 |
190 | # Redirect allows you to tell clients about documents which used to exist in
191 | # your server's namespace, but do not anymore. This allows you to tell the
192 | # clients where to look for the relocated document.
193 | # Example: Redirect /bar http://elsewhere/feh/bar
194 |
195 | # Aliases: Aliases one path to another.
196 | # Example: Alias /path1/bar /path2/foo
197 |
198 | Alias /doc /usr/doc
199 |
200 | # ScriptAlias: Maps a virtual path to a directory for serving scripts
201 | # Example: ScriptAlias /htbin/ /www/htbin/
202 |
203 | ScriptAlias /cgi-bin/ /var/www/cgi-bin/
204 |
205 |
--------------------------------------------------------------------------------
/环境搭建参考/ccgi.txt:
--------------------------------------------------------------------------------
1 | **CGIC**的主站点: [http://www.boutell.com/cgic/]
2 | 配置参考大佬博客:[项目实战](https://blog.csdn.net/a642960662/article/category/6818637)
3 |
--------------------------------------------------------------------------------
/环境搭建参考/cgic207.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ikaros-521/boa_cgi_html_mysql/9b6a309ceca109ce802041f45e6f25aa1075d211/环境搭建参考/cgic207.tar.gz
--------------------------------------------------------------------------------
/环境搭建参考/相关链接.txt:
--------------------------------------------------------------------------------
1 | BOA
2 | [Ubuntu下boa服务器的配置与搭建](https://www.cnblogs.com/jasonxiang/archive/2012/10/17/ubuntu_boa.html)
3 | 大佬写的项目实战 https://blog.csdn.net/a642960662/article/category/6818637
4 | Apache CGI
5 | sudo apt-get install apache2
6 | [ubuntu 下搭建cgi环境](https://blog.csdn.net/heibaiyijing/article/details/8538413)
7 | CCGI
8 | **CGIC**的主站点: [http://www.boutell.com/cgic/]
9 | 配置参考大佬博客:[项目实战](https://blog.csdn.net/a642960662/article/category/6818637)
10 | 我在调试中遇到的问题也在大佬的博客下面做了 **评论** ,如果大家碰到问题可以参考一下。
11 | MySQL
12 | 安装MySQL数据库
13 | sudo apt-get update
14 | sudo apt-get install mysql-server
15 |
16 | 确认是否安装成功
17 | sudo netstat -tap | grep mysql
18 | 当mysql节点处于LISTEN状态表示启动成功
19 |
20 | 登录数据库
21 | mysql -u root -p
22 | 或者直接在-p后面跟密码,如下
23 | mysql -uroot -proot
24 | 再装个mysql-client, libmysqlclient-dev
25 | sudo apt-get install mysql-client
26 | sudo apt-get install libmysqlclient-dev
27 |
28 | // 创建新用户test
29 | create user 'test'@'localhost' identified by 'test';
30 | // 给test用户所有权限
31 | grant all privileges on *.* to test@localhost identified by 'test'
32 | // 刷新权限
33 | flush privileges;
34 |
35 |
36 | 遇到问题可以参考我的博客 https://blog.csdn.net/Ikaros_521
37 |
--------------------------------------------------------------------------------