当前位置: 首页 > news >正文

Mysql的源码编译

1.下载安装包

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-boost-8.3.0.tar.gz

2.源码编译

​ [root@mysql-node1 ~]# dnf install cmake3 gcc git bison openssl-devel ncurses-devel systemd-devel rpcgen.x86_64 libtirpc-devel-1.3.3-9.el9.x86_64.rpm gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-binutils gcc-toolset-12-annobin-annocheck gcc-toolset-12-annobin-plugin-gcc -y ​ [root@mysql-node1 ~]# tar zxf mysql-boost-8.3.0.tar.gz [root@mysql-node1 mysql-8.3.0]# mkdir build [root@mysql-node1 mysql-8.3.0]# cd build/ ​ [root@mysql-node1 build]# cmake3 .. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_unicode_ci -DWITH_BOOST=bundled -DWITH_SSL=system -DWITH_DEBUG=OFF ​ ​ [root@mysql-node1 build]# make

3.部署mysql

[root@mysql-node1 build]# make install [root@mysql-node1 build]# cd /usr/local/mysql/ ​ [root@mysql-node1 mysql]# vim ~/.bash_profile # .bash_profile ​ # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi ​ # User specific environment and startup programs export PATH=$PATH:/usr/local/mysql/bin #设置mysql运行环境的环境变量 ​ ​ [root@mysql-node1 mysql]# source ~/.bash_profile ​ [root@mysql-node1 mysql]# useradd -r -s /sbin/nologin -M mysql ​ [root@mysql-node1 mysql]# mkdir -p /data/mysql [root@mysql-node1 mysql]# chown mysql.mysql /data/mysql/ ​ [root@mysql-node1 ~]# vim /etc/my.cnf [mysqld] datadir=/data/mysql socket=/data/mysql/mysql.sock

4.mysql数据结构初始化

[root@mysql-node1 ~]# mysqld --initialize --user=mysql

5.启动mysql

[root@mysql-node1 support-files]# dnf install initscripts-10.11.8-4.el9.x86_64 -y ​ [root@mysql-node1 support-files]# cd /usr/local/mysql/support-files/ [root@mysql-node1 support-files]# cp -p mysql.server /etc/init.d/mysqld ​ [root@mysql-node1 support-files]# /etc/init.d/mysqld start Starting MySQL.Logging to '/data/mysql/mysql-node1.err'. . SUCCESS! ​ #开机启动 [root@mysql-node1 support-files]# chkconfig --level 35 mysqld on ​

6.mysql的安全初始化

[root@mysql-node1 ~]# mysql_secure_installation Securing the MySQL server deployment. ​ Enter password for user root: ​ The existing password for the user account root has expired. Please set a new password. ​ New password: ​ Re-enter new password: ​ VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component? ​ Press y|Y for Yes, any other key for No: no Using existing password for root. Change the password for root ? ((Press y|Y for Yes, any other key for No) : no ​ ​ Remove anonymous users? (Press y|Y for Yes, any other key for No) : y Success. ​ ​ Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. ​ Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y Success. ​ By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. ​ ​ Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database... Success. ​ - Removing privileges on test database... Success. ​ Reloading the privilege tables will ensure that all changes made so far will take effect immediately. ​ Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success. ​ All done! ​
http://www.jsqmd.com/news/706693/

相关文章:

  • 高效编程实践:用Codex告别重复造轮子
  • Decepticon对抗样本框架:AI模型鲁棒性评估与攻击实战指南
  • wcgw:基于MCP协议实现AI与本地Shell及文件系统无缝协作的开发工具
  • 机器学习落地实战:从理论到生产的核心挑战
  • VS Code Copilot Next 自动化工作流配置:如何在8分钟内输出经AWS Well-Architected评审认证的架构设计图?(附Terraform+Mermaid双模渲染引擎)
  • VS Code Dev Containers配置效率革命(2024企业级最佳实践白皮书)
  • SVM与拉格朗日乘子法:从原理到Python实现
  • 智能电话录音总结,工具高精准识别快速整理,复盘通话超省心省事
  • 2026杭州优质办公楼出租服务标杆名录:杭州办公楼出租、杭州商务楼租赁、杭州写字楼租赁、杭州写字楼招租选择指南 - 优质品牌商家
  • 4.20-4.26
  • NVIDIA Jetson AGX Thor开发者套件:边缘AI与机器人计算新标杆
  • ggplot2数据可视化:核心语法与实战技巧
  • OpenClaw Embodiment SDK:事件驱动的硬件抽象层与多模态情境感知
  • 力扣算法刷题 Day 53
  • 别再让手机GPU吃灰了!手把手教你用Termux编译NCNN,解锁安卓Vulkan加速
  • 时间序列分析实战:从基础到生产部署全解析
  • 线性代数在机器学习中的核心应用:从线性回归到矩阵运算
  • MacBook Pro用户必看:M4芯片的38 TOPS Neural Engine,真能让Stable Diffusion本地跑得更快吗?
  • AutoGen群聊模式:模拟真实团队协作的奥秘
  • 别再死记硬背公式了!用Python手把手带你实现Transformer的Sinusoidal位置编码(附完整代码)
  • 集成学习预测融合:原理、实战与优化策略
  • 山东大学创新实训项目小组进度(二)
  • 基于RAG与向量数据库的代码库AI智能体Atlas实战指南
  • 从‘酷女孩’到‘商务女性’:用Stable Diffusion + Lora 玩转AI人像风格化的实战心得
  • 别再硬编码IP了!K8s里Nginx反向代理Service的正确姿势(CoreDNS + Headless Service实战)
  • AWS CDK构造库实战:快速构建生成式AI应用基础设施
  • 学术海报自动化生成:从论文到海报的智能转换技术解析
  • 2026热门幕墙铝单板:冲孔铝板/双曲铝单板/双曲铝板/幕墙铝板/异型铝板/异形铝单板/木纹铝单板/木纹铝板/氟碳铝单板/选择指南 - 优质品牌商家
  • 从科研到临床:手把手教你用Python实现fNIRS脑网络的图论分析(附代码与数据)
  • OpenCV随机森林实现轻量级图像分类实战