TinyWebServer学习笔记(一):WSL编译运行

1.MySQL安装

# 系统环境:Win11的WSL
# 1.安装mysql相关模块
>> sudo apt-get install mysql-server -y
>> sudo apt-get install libmysqlclient-dev -y

2.MySQL配置

# 1.进入mysql
>> sudo mysql
# 2.进入mysql数据库
mysql> use mysql;
# 3.修改root用户密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
# 4.修改远程访问
mysql> UPDATE user SET `Host` = '%' WHERE `User` = 'root' LIMIT 1;
mysql> flush privileges;
mysql> exit;
# 5.创建数据库
mysql> create database webdb;
# 6.给创建的数据库创建表
mysql> use webdb;
mysql> create table user(
  username char(50) NULL,
  passwd char(50) NULL
) engine=InnoDB;
# 7.创建用户
mysql> create user 'mirror'@'localhost' identified by 'cjy';
# 8.给用户mirror表访问权限
mysql> grant all on webdb.user to 'mirror'@'localhost';
# 9.刷新系统权限,即时生效
mysql> flush privileges;

3.源码下载

>> git clone https://github.com/qinguoyi/TinyWebServer.git

4.修改main.cpp文件中user, passwd, databasename三个选项:

string user = "mirror";
string passwd = "cjy";
string databasename = "webdb";

5.编译运行TinyWebServer项目

>> chmod +x build.sh && ./build.sh && ./server

6.运行结果查询

# 浏览器运行
localhost:9006

7.参考项目

相关推荐

  1. TinyWebServer学习笔记():WSL编译运行

    2024-04-24 07:02:01       12 阅读
  2. 初次运行TinyWebServer遇到的问题

    2024-04-24 07:02:01       12 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-24 07:02:01       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-24 07:02:01       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-24 07:02:01       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-24 07:02:01       18 阅读

热门阅读

  1. union节省内存

    2024-04-24 07:02:01       11 阅读
  2. c# ?? 、?.、??=、?[]运算符的使用

    2024-04-24 07:02:01       15 阅读
  3. 【贪心算法】Leetcode 763. 划分字母区间【中等】

    2024-04-24 07:02:01       14 阅读
  4. stl_list

    stl_list

    2024-04-24 07:02:01      11 阅读
  5. uniapp同步开发h5+小程序双平台踩坑记录

    2024-04-24 07:02:01       10 阅读
  6. 景区ar导览实景导航小程序系统开发源码搭建

    2024-04-24 07:02:01       14 阅读
  7. 深入了解 npm

    2024-04-24 07:02:01       14 阅读
  8. windows驱动开发-I/O请求(三)

    2024-04-24 07:02:01       14 阅读
  9. 计算机网络 2.3数据交换技术

    2024-04-24 07:02:01       11 阅读