您好,登錄后才能下訂單哦!
下面一起來了解下源碼編譯安裝mysql-5.7.23的詳細步驟,相信大家看完肯定會受益匪淺,文字在精不在多,希望源碼編譯安裝mysql-5.7.23的詳細步驟這篇短內容是你想要的。
# wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.23.tar.gz # tar xf mysql-5.7.23.tar.gz
隱藏版本信息是XX電信運營商提出的變態(tài)要求,經測試版本信息不能直接刪除,否則編譯出錯,暫時修改為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
創(chuàng)建mysql用戶和組 # groupadd -g 306 mysql 不需要登錄也不需要創(chuàng)建家目錄 # 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# 配置環(huán)境變量 # cat > /etc/profile.d/mysql.sh <<EOF export PATH=/usr/local/mysql/bin:$PATH EOF # source /etc/profile
# 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的詳細步驟這篇文章后,很多讀者朋友肯定會想要了解更多的相關內容,如需獲取更多的行業(yè)信息,可以關注我們的行業(yè)資訊欄目。
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。