mysql 源码编译_MYSQL源码编译与配置

1.安装依赖包yum install -y cmake ncurses-devel libtirpc*

2.安装boosttar xzf boost_1_70_0.tar.gzmv boost_1_70_0 /usr/local/boost

3.安装rpcsvctar zxvf rpcsvc-proto-1.4.tar.gzcd rpcsvc-proto-1.4/./configuremakemake install

4.安装mysql-boosttar xzf mysql-boost-8.0.18.tar.gzcd mysql-8.0.18/cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DWITH_BOOST=/usr/local/boost -DFORCE_INSOURCE_BUILD=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_cimakemake install

5.mysql配置文件(这几个文件需要自己拷贝,配合目录[root@chenbaojin my.cnf.d]# ls)也是手动创建,在cmake是没有指认配置文件,所以需要

## mkdir my.cnf.d   在进行copy一份配置/etc/my.cnf/etc/my.cnf.d/client.cnf/etc/my.cnf.d/mysql-default-authentication-plugin.cnf/etc/my.cnf.d/mysql-server.cnf

6.创建mysql用户useradd -M -s /sbin/nologin mysqlsetfacl -m u:mysql:rwx -R /usr/local/mysqlsetfacl -m d:u:mysql:rwx -R /usr/local/mysql

7.初始化数据库/usr/local/mysql/bin/mysqld --initialize --user=mysql

#临时密码这个随机生成

8.启动服务/usr/local/mysql/bin/mysqld_safe --user=mysql &

9.mysql服务开机启动vi /etc/rc.local/usr/local/mysql/bin/mysqld_safe --user=mysql &

10.重置密码/usr/local/mysql/bin/mysqladmin -uroot -p'HF&s#9Zped3s' password '123';set password='123';alter user 'root'@'localhost' identified by '123';

11.客户端登录/usr/local/mysql/bin/mysql -uroot -p123

12.查看进程pstree |grep mysqld

13.查看端口netstat -tunpl |grep mysqld

14.关闭服务pkill mysqld

疑难问题:注意:-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci,现在mysql8的字符集已经是utf8了,如果只是提示并没有明显的错误可以不用管它,如果有明显的编译错误,可以在编译时把这两个有关utf8的参数取掉即可.

问题一、在编译mysql的时候我的服务器报了个这样的问题如下:[root@chenbaojin mysql-8.0.18]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DWITH_BOOST=/usr/local/boost -DFORCE_INSOURCE_BUILD=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci-- Running cmake version 3.11.4-- Could NOT find Git (missing: GIT_EXECUTABLE)-- MySQL 8.0.18-- The CXX compiler identification is unknownCMake Error at CMakeLists.txt:311 (PROJECT):No CMAKE_CXX_COMPILER could be found.Tell CMake where to find the compiler by setting either the environmentvariable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full pathto the compiler, or to the compiler name if it is in the PATH.-- Configuring incomplete, errors occurred!See also "/mnt/mysql-8.0.18/CMakeFiles/CMakeOutput.log".See also "/mnt/mysql-8.0.18/CMakeFiles/CMakeError.log".[root@chenbaojin mysql-8.0.18]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DWITH_BOOST=/usr/local/boost -DFORCE_INSOURCE_BUILD=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci-- Running cmake version 3.11.4-- Could NOT find Git (missing: GIT_EXECUTABLE)-- MySQL 8.0.18-- The CXX compiler identification is unknownCMake Error at CMakeLists.txt:311 (PROJECT):No CMAKE_CXX_COMPILER could be found.Tell CMake where to find the compiler by setting either the environmentvariable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full pathto the compiler, or to the compiler name if it is in the PATH.-- Configuring incomplete, errors occurred!See also "/mnt/mysql-8.0.18/CMakeFiles/CMakeOutput.log".See also "/mnt/mysql-8.0.18/CMakeFiles/CMakeError.log".解决方案:查看了rpm发现没有gcc这个包,我安装了一个gccrpm -qa|grep gcc-c++yum install gcc-c++

源码下载:源码包已经下载好:链接:https://pan.baidu.com/s/1nKl9T8drBcHO_OihrZOr_w提取码:m9b6

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值