1、下载工程并解压
git clone https://github.com/qinguoyi/TinyWebServer.git
或则下载.zip传到linux,并利用unzip解压缩
apt-get install unzip
unzip Tinywebserver.zip
2、安装Mysql
sudo apt-get install mysql-server //安装
service mysql start //启动
mysql -u root -p //连接mysql服务器
CREATE DATABASE test; //建表
mysqladmin --version
mysql
mysqladmin -u root password "new_password" //修改密码
3、配置运行
https://zhuanlan.zhihu.com/p/654519899
sudo mysql -uroot -p //进入mysql
create database yourdb;
USE yourdb;
CREATE TABLE user(
username char(50) NULL,
passwd char(50) NULL
)ENGINE=InnoDB;
INSERT INTO user(username, passwd) VALUES('name', 'passwd'); //创建数据库
cd /etc/mysql
sudo vim debian.cnf //查看用户名与密码,并配置main.cpp
4、编译运行
cd Tinywebserver
sh ./build.sh //运行脚本
apt-get install libmysqlclient-dev //如果出现fatal error: mysql.h: No such file or directory错误则安装
./server