- 实验目的
- 学习MySQL服务器搭建的流程,掌握MySQL服务器搭建及使用方法;
- 学习 MySQL相关库函数,掌握C语言中MySQL的编程方法。
- 实验扩展
(选做,包括实验扩展的代码和运行结果截图)
Server-kai.c
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <mysql/mysql.h>
int main(int argc,char **argv)
{
int sid = socket(AF_INET,SOCK_STREAM,0);
struct sockaddr_in addr = {0};
addr.sin_family = AF_INET;
addr.sin_port = htons(atoi(argv[2]));