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