当前位置: 首页 > 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.cnnetsun.cn/news/2107349.html

相关文章:

  • 从防御者视角复盘:一次真实的Shiro漏洞应急响应与加固指南(附排查脚本)
  • 从科研到临床:手把手教你用Python实现fNIRS脑网络的图论分析(附代码与数据)
  • ChatDev 2.0 从零到一:零代码多智能体编排平台实战指南
  • 别再让UWP应用连不上localhost了!用CheckNetIsolation.exe一键解除Windows本地回环限制
  • Elastix参数文件(.txt)调参实战:从‘能用’到‘精准’的避坑指南
  • 避开芯片布局的坑:聊聊Global Placement中那些容易误解的优化目标(线长、拥挤度、切割量)
  • AI驱动游戏开发:零重力角力项目实战与氛围编程解析
  • envd:AI开发环境管理利器,告别配置依赖冲突与协作难题
  • Anterion:开发者个人知识库的工程化实践与高效管理方案
  • SpringBoot+Vue小型民营加油站管理系统源码+论文
  • XGBoost机器学习实战:从入门到调优全解析
  • 从原理到实战:拆解STM32+FATFS的SD卡文件‘追加’操作,哪种方法最适合你的项目?
  • 【简单】根据后序数组重建搜索二叉树-Java:进阶问题
  • 机器学习优化算法经典书籍与实战技巧
  • Awesome Codex Skills中的Supadata自动化:数据管理和处理的集成指南
  • 量子纠缠检测的SWAP测试原理与光子芯片实现
  • 如何掌握PyTorch Image Models自适应池化层:提升图像分类性能的终极指南
  • 正则表达式终极指南:10个文本处理匹配技巧
  • 开发者必备:开源命令行工具箱Toolmate的设计原理与实战应用
  • owl4ce/dotfiles双主题切换:从机械风到艺术风的完美转换
  • NumPy矩阵运算在机器学习中的核心应用与优化技巧
  • 终极Meteor社区资源指南:论坛、博客和教程一站式汇总
  • DevDocs隐私保护终极指南:用户数据合规处理与安全配置全解析
  • 机器学习课程选择与学习路径全指南
  • 2025届最火的五大降重复率方案推荐榜单
  • 终极PHP导航菜单指南:从KnpMenu到Spatie Menu的完整实现方案
  • 解锁Yew Canvas绘图潜能:10个高效技巧打造惊艳2D和3D图形渲染
  • 终极指南:Consul服务发现如何实现高可用的服务注册表与元数据管理
  • 如何快速掌握Preact多媒体应用开发:构建现代音视频处理应用的完整指南
  • 如何快速掌握Type Challenges中的数组最后一个元素类型提取技巧