数据库结课项目 环境搭建[rootlocalhost ~]# systemctl disable --now firewalld [rootlocalhost ~]# systemctl stsus firewall [rootlocalhost ~]# date -s yyyy-mm-dd安装依赖[rootlocalhost ~]# dnf install -y gcc-c make cmake zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel libffi-devel tk-devel wget tar vim tree net-tools openssh-sever安装python[rootlocalhost ~]# cd/usr/local/src [rootlocalhost src]# tar -zxvf Python-3.11.9.tgz [rootlocalhost src]# cd Python-3.11.9 [rootserver Python-3.11.9]# ./configure --prefix/usr/local/python3.11 --enable-shared [rootserver Python-3.11.9]# make make install [rootserver Python-3.11.9]# echo $(nproc) [rootserver Python-3.11.9]# make -j2 [rootserver Python-3.11.9]# echo /usr/local/python3.11/lib /etc/ld.so.conf.d/python311.conf [rootserver Python-3.11.9]# ldconfig --- 生效 [rootserver Python-3.11.9]# ln -s /usr/local/python3.11/bin/python3.11 /usr/local/bin/python3 [rootserver Python-3.11.9]# ln -s /usr/local/python3.11/bin/pip3.11 /usr/local/bin/pip3 [rootserver Python-3.11.9]# bash [rootserver Python-3.11.9]# python3 -V [rootserver Python-3.11.9]# pip3 -V验证SSl模块[rootserver Python-3.11.9]# python3 -c import ssl; print(ssl.OPENSSL_VERSION)配置pip源[rootserver ~]# mkdir .pip [rootserver ~]# ls -a [rootserver ~]# cs .pip [rootserver .pip]# ls [rootserver ~]# pip3 install --upgrade pip [rootserver ~]# pip3 install pymysql python-dotenv tabulate langchain langchain-openai部署数据库mysql show databases; -------------------- | Database | -------------------- | information_schema | | mysql | | performance_schema | | sys | -------------------- 4 rows in set (0.01 sec) mysql create database testdb; mysql use testdb; mysql create table order_info( id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT 订单ID, user_id INT COMMENT 用户ID, order_name VARCHAR(200) COMMENT 商品名称, pay_amount DECIMAL(10,2) COMMENT 支付金额, create_time DATETIME COMMENT 下单时间 ) ENGINEInnoDB COMMENT电商订单业务表; mysql INSERT INTO order_info(user_id,order_name,pay_amount,create_time) VALUES INSERT INTO order_info(user_id,order_name,pay_amount,create_time) VALUES (1001,智能手机,2999.00,2026-05-01 10:20:00), (1001,有线入耳耳机,199.00,2026-05-02 14:10:00), (1002,14英寸轻薄笔记本电脑,5499.00,2026-05-03 09:30:00), (1002,无线蓝牙鼠标,89.00,2026-05-03 09:35:00), (1003,平板学习机,1799.00,2026-05-04 11:05:00), (1003,平板专用保护壳,49.00,2026-05-04 11:08:00), (1004,机械游戏键盘,349.00,2026-05-05 16:42:00), (1004,电竞头戴耳机,459.00,2026-05-05 16:48:00), (1005,大屏智能电视,3299.00,2026-05-06 08:15:00), (1005,电视壁挂支架,129.00,2026-05-06 08:20:00), (1006,无线快充充电器,129.00,2026-05-03 13:22:00), (1006,降噪蓝牙耳机,399.00,2026-05-03 13:25:00), (1007,电竞显示器,1899.00,2026-05-07 10:10:00), (1007,显示器增高支架,79.00,2026-05-07 10:15:00), (1008,折叠平板支架,39.00,2026-05-04 15:30:00), (1008,便携充电宝,159.00,2026-05-04 15:33:00), (1009,台式游戏主机,6999.00,2026-05-08 09:05:00), (1009,电竞防滑鼠标垫,59.00,2026-05-08 09:08:00), (1010,手机钢化膜,29.00,2026-05-05 17:12:00), (1010,桌面收纳支架,45.00,2026-05-05 17:16:00); mysql select * from order_info; ----------------------------------------------------------------------------- | id | user_id | order_name | pay_amount | create_time | ----------------------------------------------------------------------------- | 1 | 1001 | 智能手机 | 2999.00 | 2026-05-01 10:20:00 | | 2 | 1001 | 有线入耳耳机 | 199.00 | 2026-05-02 14:10:00 | | 3 | 1002 | 14英寸轻薄笔记本电脑 | 5499.00 | 2026-05-03 09:30:00 | | 4 | 1002 | 无线蓝牙鼠标 | 89.00 | 2026-05-03 09:35:00 | | 5 | 1003 | 平板学习机 | 1799.00 | 2026-05-04 11:05:00 | | 6 | 1003 | 平板专用保护壳 | 49.00 | 2026-05-04 11:08:00 | | 7 | 1004 | 机械游戏键盘 | 349.00 | 2026-05-05 16:42:00 | | 8 | 1004 | 电竞头戴耳机 | 459.00 | 2026-05-05 16:48:00 | | 9 | 1005 | 大屏智能电视 | 3299.00 | 2026-05-06 08:15:00 | | 10 | 1005 | 电视壁挂支架 | 129.00 | 2026-05-06 08:20:00 | | 11 | 1006 | 无线快充充电器 | 129.00 | 2026-05-03 13:22:00 | | 12 | 1006 | 降噪蓝牙耳机 | 399.00 | 2026-05-03 13:25:00 | | 13 | 1007 | 电竞显示器 | 1899.00 | 2026-05-07 10:10:00 | | 14 | 1007 | 显示器增高支架 | 79.00 | 2026-05-07 10:15:00 | | 15 | 1008 | 折叠平板支架 | 39.00 | 2026-05-04 15:30:00 | | 16 | 1008 | 便携充电宝 | 159.00 |2026-05-04 15:33:00 | | 17 | 1009 | 台式游戏主机 | 6999.00 | 2026-05-08 09:05:00 | | 18 | 1009 | 电竞防滑鼠标垫 | 59.00 | 2026-05-08 09:08:00 | | 19 | 1010 | 手机钢化膜 | 29.00 | 2026-05-05 7:12:00 | | 20 | 1010 | 桌面收纳支架 | 45.00 | 2026-05-05 17:16:00 | ----------------------------------------------------------------------------- 20 rows in set (0.00 sec)脚本开发[rootserver ~]# mkdir -p /opt/mysql_ai_tools [rootserver ~]# cd /opt/mysql_ai_tools [rootserver mysql_ai_tools]# touch main.py mysql_client.py prompts.py web_main.py.env [rootserver mysql_ai_tools]# tree -La 1 [rootserver mysql_ai_tools]# vim /opt/mysql_ai_tools/.env

相关新闻

最新新闻

SerenityOS 命令行选项解析指南:getopt 与 getopt_long 用法、返回值与底层实现

SerenityOS 命令行选项解析指南:getopt 与 getopt_long 用法、返回值与底层实现

SerenityOS 命令行选项解析指南:getopt 与 getopt_long 用法、返回值与底层实现 【免费下载链接】serenity The Serenity Operating System 🐞 项目地址: https://gitcode.com/GitHub_Trending/se/serenity 导读 本文以 getopt(3) 手册 为核心&a…

2026/9/28 1:37:33
轻量服务器还是ECS?大促云服务器选购与避坑实战指南

轻量服务器还是ECS?大促云服务器选购与避坑实战指南

每年大促节点,群里永远有人在问同一个问题:“38元的轻量服务器到底怎么抢?为什么我每次点进去都是已售罄?68元直购和99元的ECS我到底选哪个?”作为一个常年帮团队和自己采购云服务器的老用户,我太清楚这种纠…

2026/9/27 19:13:42
为 AI 代理的 Review 动作编写 Cedar 审批门控策略:review-agent-governance 策略编写实战指南

为 AI 代理的 Review 动作编写 Cedar 审批门控策略:review-agent-governance 策略编写实战指南

为 AI 代理的 Review 动作编写 Cedar 审批门控策略:review-agent-governance 策略编写实战指南 【免费下载链接】agents Multi-harness agentic plugin marketplace for Claude Code, Codex, Cursor, OpenCode, GitHub Copilot, and Google Antigravity 项目地址:…

2026/9/27 15:27:56
PaddleOCR 手写数学公式识别算法 CAN 实战指南:Counting-Aware Network 训练、评估与推理部署

PaddleOCR 手写数学公式识别算法 CAN 实战指南:Counting-Aware Network 训练、评估与推理部署

PaddleOCR 手写数学公式识别算法 CAN 实战指南:Counting-Aware Network 训练、评估与推理部署 【免费下载链接】PaddleOCR Turn any PDF or image document into structured data for your AI. A powerful, lightweight OCR toolkit that bridges the gap between i…

2026/9/27 19:54:03
Spring源码解析:构造器注入的类型转换与候选匹配机制

Spring源码解析:构造器注入的类型转换与候选匹配机制

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/9/27 9:16:41
openai-agents-python 多模型接入指南:深入解析 AnyLLMModel 适配层与 any-llm 路由

openai-agents-python 多模型接入指南:深入解析 AnyLLMModel 适配层与 any-llm 路由

openai-agents-python 多模型接入指南:深入解析 AnyLLMModel 适配层与 any-llm 路由 【免费下载链接】openai-agents-python A lightweight, powerful framework for multi-agent workflows 项目地址: https://gitcode.com/GitHub_Trending/op/openai-agents-pyth…

2026/9/28 2:08:29

日新闻

周新闻