简述MySql8.0编译安装过程
发表于:2025-02-07 作者:千家信息网编辑
千家信息网最后更新 2025年02月07日,环境:Centos8最小化安装[root@Oracle2 ~]# cat /etc/redhat-release CentOS Linux release 8.0.1905 (Core) 注意:不要用
千家信息网最后更新 2025年02月07日简述MySql8.0编译安装过程
环境:Centos8最小化安装
[root@Oracle2 ~]# cat /etc/redhat-release CentOS Linux release 8.0.1905 (Core)
注意:不要用8以下的系统编译MySQL8,会存在各个工具版本不够高的各种报错,非常麻烦
Mysql版本
mysql-8.0.18
第一步:安装依赖包
安装rpcgen,从这里下载
https://github.com/thkukuk/rpcsvc-proto/releases
[root@test3 mysql]# wget https://github.com/thkukuk/rpcsvc-proto/releases/download/v1.4/rpcsvc-proto-1.4.tar.gz[root@test3 mysql]# tar -xzf rpcsvc-proto-1.4.tar.gz [root@test3 mysql]# cd rpcsvc-proto-1.4/[root@test3 rpcsvc-proto-1.4]# ./configure[root@test3 rpcsvc-proto-1.4]# make && make install
安装其他依赖
yum install -y ncurses-devel cmake gcc perl-Data-Dumper gcc-c++ git openssl-devel make
第二步:下载MySQL到boots源码包
下载地址:https://dev.mysql.com/downloads/mysql/
解压tar -xzf mysql-boost-8.0.18.tar.gzcd mysql-8.0.18/
第三步:编译安装
检查[root@test3 mysql-8.0.18]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DFORCE_INSOURCE_BUILD=1 -DWITH_BOOST=boost/开始编译安装[root@test3 mysql-8.0.18]# make -j 4 && make install
可能会存在的报错:
-- Running cmake version 3.11.4-- Found Git: /usr/bin/git (found version "2.18.1") -- MySQL 8.0.18CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.CMake Error: CMAKE_C_COMPILER not set, after EnableLanguageCMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage-- Configuring incomplete, errors occurred!See also "/root/mysql/mysql-8.0.18/CMakeFiles/CMakeOutput.log".
解决办法:
[root@test3 mysql-8.0.18]# yum install -y make
报错:
Cannot find appropriate system libraries for WITH_SSL=system.Make sure you have specified a supported SSL version. Valid options are : system (use the OS openssl library), yes (synonym for system), **
解决办法:
[root@test3 mysql-8.0.18]# yum install -y openssl-devel
报错:
-- Checking for module 'libtirpc'-- Package 'libtirpc', required by 'virtual:world', not foundCMake Error at cmake/rpc.cmake:65 (MESSAGE): Could not find rpc/rpc.h in /usr/include or /usr/include/tirpcCall Stack (most recent call first): plugin/group_replication/libmysqlgcs/configure.cmake:57 (MYSQL_CHECK_RPC) plugin/group_replication/libmysqlgcs/CMakeLists.txt:28 (INCLUDE)
解决办法:
[root@test3 mysql-8.0.18]# yum install -y libtirpc-devel
第四步:配置
新建数据存放目录[root@test3 mysql-8.0.18]# mkdir /data/mysql -p[root@test3 mysql-8.0.18]# chown mysql:mysql /data/mysql/[root@test3 mysql-8.0.18]# chown mysql:mysql -R /usr/local/mysql/[root@test3 mysql-8.0.18]# cp support-files/mysql.server /usr/local/sbin/[root@test3 mysql-8.0.18]# chmod 755 /usr/local/sbin/mysql.server
到这里生成一份配置文件放到/etc/my.cnf
https://imysql.com/my-cnf-wizard.html
初始化数据库
[root@test3 mysql-8.0.18]# /usr/local/mysql/bin/mysqld --initialize --user=mysql启动数据库[root@test3 mysql-8.0.18]# mysql.server startStarting MySQL... SUCCESS! 配置环境变量[root@test3 mysql-8.0.18]# echo 'PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile[root@test3 mysql-8.0.18]# source /etc/profile
第五步:登录
找到临时密码[root@test3 mysql-8.0.18]# grep password /data/mysql/error.log | grep root2020-01-09T22:18:59.395962+08:00 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: MYtoDe(>o6i&修改临时root密码[root@test3 mysql-8.0.18]# mysqladmin -u root -p password "Re@1dh7at"Enter password: mysqladmin: [Warning] Using a password on the command line interface can be insecure.Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.用root登录[root@test3 mysql-8.0.18]# mysql -pEnter password:
第六步:新建数据库并授权用户
注:Mysql 从8.0起就不能把授权数据库和新建用户放到一条命令了
新建testdb数据库root@Oracle2 22:30: [(none)]> create database testdb;Query OK, 1 row affected (0.01 sec)新建testuser用户并设置密码root@Oracle2 22:35: [(none)]> create user testuser@127.0.0.1 identified by 'huH345sfrfs';Query OK, 0 rows affected (0.01 sec)授权root@Oracle2 22:36: [(none)]> grant all privileges on testdb.* to testuser@127.0.0.1;Query OK, 0 rows affected (0.00 sec)
数据
数据库
编译
办法
密码
用户
配置
版本
环境
登录
最小
不够
变量
命令
地址
工具
文件
源码
目录
系统
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
校园网络安全手抄报7年级
软件开发实用那些工具
数据库语句修改成绩为100
本溪app软件开发
戴尔服务器620和720哪款好
2021璧山网络安全周
失落的方舟steam服务器选择
哪一年刑法界定网络安全
怀柔区制造软件开发规定
数据库中信息
电脑字体能通过服务器互联吗
帝王三国有几个服务器
工程技术开发和网络技术开发
网络服务器和光纤哪个快
教师网络安全教育征文
后天下载软件开发
广州楼控管理软件开发中心
电力监控网络安全等级
网络安全管理培训讲义
农业数据库系统
我的世界肥皂服务器
郑州服务器回收多少钱
毕业设计 数据库设计
网络安全作文大学
火车头大数据库
安全卫士服务器版本
主机 服务器 游戏
软件开发 项目 案例 简介
用友u8应用服务器改ip
中文编写数据库软件