您好,登錄后才能下訂單哦!
下面講講關于centso7.2源碼方式安裝mysql的幾個步驟,文字的奧妙在于貼近主題相關。所以,閑話就不談了,我們直接看下文吧,相信看完centso7.2源碼方式安裝mysql的幾個步驟這篇文章你一定會有所受益。
源碼方式安裝 mysql-boost-5.7.17.tar.gz
1、 準備工作
關閉SELinux, 防火墻 下載軟件包 ------>https://www.mysql.com/
卸載自帶的mariadb
2、卸載系統自帶的mariadb軟件
[root@mysqltest ~]# rpm -qa | grep mariadb
mariadb-libs-5.5.44-2.el7.centos.x86_64
[root@mysqltest ~]# rpm -e --nodeps mariadb-libs
3、創建數據目錄 /mydata/data
[root@mysqltest ~]# mkdir -p /mydata/data
修改數據目錄的所屬
[root@node02 ~]# useradd -s /sbin/nologin -M mysql
[root@node02 ~]# chown -R mysql.mysql /mydata/data/
4、安裝cmake編譯器
[root@node02 ~]# yum install -y cmake
[root@node02 ~]# tar zxf mysql-boost-5.7.17.tar.gz
cmake. -L 查看cmake支持的編譯選項
[root@node02 ~]# cd mysql-5.7.17/
[root@mysql57 mysql-5.7.17]# cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_DATADIR=/mydata/data \
-DMYSQL_TCP_PORT=3306 \
-DWITH_BOOST=boost/boost_1_59_0/ \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
錯誤1:
CMake Error: your C compiler: "CMAKE_C_COMPILER-NOTFOUND" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
CMake Error at cmake/os/Linux.cmake:41 (MESSAGE):
Unsupported compiler!
Call Stack (most recent call first):
CMakeLists.txt:162 (INCLUDE)
解決辦法:
# yum groupinstall -y "Development Tools" "Server Platform Development" "Desktop Platform Development"
錯誤2:
CMake Error at cmake/readline.cmake:64 (MESSAGE):
Curses library not found. Please install appropriate package,
解決辦法:
[root@node02 ~]# yum install -y ncurses-devel.x86_64
[root@mysqltest mysql-5.7.17]# make
[root@mysqltest mysql-5.7.17]# make install
[root@mysqltest ~]# chown -R root.mysql /usr/local/mysql/
5、初始化數據庫
[root@mysql57 ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/mydata/data
6、復制MySQL配置文件
[root@node02 ~]# cd /usr/local/mysql/support-files/
[root@node02 support-files]# cp my-default.cnf /etc/my.cnf
[root@node02 support-files]# vim /etc/my.cnf
[mysqld]
...
basedir=/usr/local/mysql
datadir=/mydata/data
port=3306
server_id=121
socket=/tmp/mysql.sock
7、啟動mysql服務
[root@mysqltest data]# /usr/local/mysql/bin/mysqld_safe --user=mysql &
[root@mysqltest data]# ss -antp | grep mysqld
LISTEN 0 80 :::3306 :::* users:(("mysqld",pid=63756,fd=20))
[root@mysqltest data]#
8、修改環境變量PATH
[root@mysqltest] export PATH=$PATH:/usr/local/mysql/bin 臨時的
[root@mysqltest] echo $PATH
[root@mysqltest data]# cat /etc/profile.d/mysql.sh
export PATH=$PATH:/usr/local/mysql/bin
[root@mysqltest data]# source /etc/profile.d/mysql.sh
[root@mysqltest data]# mysql -u root -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Www.1.com';
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
9、設置源碼mysql服務開機自啟動
# vim /etc/rc.d/rc.local
/usr/local/mysql/bin/mysqld_safe --user=mysql &
對于以上centso7.2源碼方式安裝mysql的幾個步驟相關內容,大家還有什么不明白的地方嗎?或者想要了解更多相關,可以繼續關注我們的行業資訊板塊。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。