重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
下面一起来了解下源码编译安装MySQL-5.7.23的详细步骤,相信大家看完肯定会受益匪浅,文字在精不在多,希望源码编译安装mysql-5.7.23的详细步骤这篇短内容是你想要的。
创新互联建站是一家专注于成都网站建设、网站设计与策划设计,巨野网站建设哪家好?创新互联建站做网站,专注于网站建设10余年,网设计领域的专业建站公司;建站业务涵盖:巨野等地区。巨野做网站价格咨询:028-86922220
# wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.23.tar.gz # tar xf mysql-5.7.23.tar.gz
隐藏版本信息是XX电信运营商提出的变态要求,经测试版本信息不能直接删除,否则编译出错,暂时修改为100.100.100
# cd mysql-5.7.23 # vim VERSION MYSQL_VERSION_MAJOR=100 MYSQL_VERSION_MINOR=100 MYSQL_VERSION_PATCH=100 MYSQL_VERSION_EXTRA=
版本高于5.8版本报错
#error "show_compatibility_56 is to be removed in MySQL 5.8"
解决办法:
修改sql/mysqld.cc源代码,将下面的内容(346-352行)
#if MYSQL_VERSION_ID >= 50800 #error "show_compatibility_56 is to be removed in MySQL 5.8" #else /* Default value TRUE for the EMBEDDED_LIBRARY, default value from Sys_show_compatibility_56 otherwise. */ my_bool show_compatibility_56= TRUE; #endif /* MYSQL_VERSION_ID >= 50800 */
修改为
//#if MYSQL_VERSION_ID >= 50800 //#error "show_compatibility_56 is to be removed in MySQL 5.8" //#else /* Default value TRUE for the EMBEDDED_LIBRARY, default value from Sys_show_compatibility_56 otherwise. */ my_bool show_compatibility_56= TRUE; //#endif /* MYSQL_VERSION_ID >= 50800 */
然后重新编译即可。
# yum -y install gcc gcc-c++ cmake ncurses-devel bsion
编译过程中需要用到boost_1_59_0,因为没有安装,所以加上-DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local
# cmake -DDOWNLOAD_BOOST=1 \ -DWITH_BOOST=/usr/local \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DMYSQL_TCP_PORT=3306 # make && make install
创建mysql用户和组 # groupadd -g 306 mysql 不需要登录也不需要创建家目录 # useradd -u 306 -g 306 -s /bin/false -M mysql # chown -R mysql:mysql /usr/local/mysql 初始化 # cd /usr/local/mysql # ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 2>&1 | tee data/mysql_init.log 提示:启动时会生成初始密码,记得查看,忘记了可以查看文件data/mysql_init.log 设置开机启动 # cp support-files/mysql.server /etc/init.d/mysql # chkconfig --add mysql # chkconfig mysql on # service mysql start # grep "temporary password" data/mysql_init.log 2018-10-13T05:25:14.146820Z 1 [Note] A temporary password is generated for root@localhost: f57d_Fp4(Hq# 配置环境变量 # cat > /etc/profile.d/mysql.sh <6.验证mysql
# mysql -p Enter password: 输入启动时生成的初始密码f57d_Fp4(Hq# Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 100.100.100 Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> 可以看到mysql已经启动正常,并且版本是我们自定义的版本信息 5.7版本mysql需要先修改用户密码才能进行下一步操作 mysql> alter user 'root@'localhost' identified by 'db.0easy.com'; Query OK, 0 rows affected (0.00 sec) 查看版本信息 mysql> select @@version; +-------------+ | @@version | +-------------+ | 100.100.100 | +-------------+1 row in set (0.00 sec)
看完源码编译安装mysql-5.7.23的详细步骤这篇文章后,很多读者朋友肯定会想要了解更多的相关内容,如需获取更多的行业信息,可以关注我们的行业资讯栏目。
当前标题:源码编译安装mysql-5.7.23的详细步骤
文章来源:http://cqcxhl.com/article/jciscd.html