編譯前安裝準備
創(chuàng)新互聯主營黃龍網站建設的網絡公司,主營網站建設方案,app軟件開發(fā)公司,黃龍h5成都小程序開發(fā)搭建,黃龍網站營銷推廣歡迎黃龍等地區(qū)企業(yè)咨詢
OS:CentOS 6.9
MySQL:5.7.18
下載Mysql源
官網源:mysql-boost mysql
搜狐源:mysql-boost mysql
安裝Mysql之前卸載原有的版本
查詢Mysql目錄文件 卸載原有MySQL
# rpm -qa | grep mysql
# find / -name mysql
# yum remove -y mysql-libs-5.1.73-3.el6_5.x86_64
安裝編譯環(huán)境
# yum -y install make wget gcc-c++ cmake bison-devel ncurses-devel
Preconfiguration setup
# groupadd mysql
# useradd -r -g mysql -s /bin/false mysql
Beginning of source-build specific instructions
# mkdir ~/mysql && cd ~/mysql
# mkdir -p /data/mysql_data
# wget -c https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.18.tar.gz
# tar -zxvf mysql-boost-5.7.18.tar.gz && cd mysql-5.7.18/
# cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysql_data \
-DSYSCONFDIR=/etc \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/usr/local/boost \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
# make
# make install
End of source-build specific instructions
Postinstallation setup
# cd /usr/local/mysql
# chown -R mysql .
# chgrp -R mysql .
Before MySQL 5.7.6
# bin/mysql_install_db --user=mysql
MySQL 5.7.6 and up
# bin/mysqld --initialize --user=mysql
# bin/mysql_ssl_rsa_setup
# chown -R root .
# chown -R mysql /data
# bin/mysqld_safe --user=mysql &
配置開機啟動項
# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql.server
# chmod +x /etc/init.d/mysql.server
# chkconfig --add mysql.server
# chkconfig mysql.server on
配置/etc/my.cnf 僅供參考,可以不配用默認的。
啟動mysql
# service mysql.server start
加入開機啟動項
# chkconfig --live 35 mysql.server on
查看端口是否被占用
# netstat -tulnp | grep 3306
查看數據庫版本
# ln -s /usr/local/mysql/bin/mysql /usr/bin/
# mysql --version
登入數據庫
# mysql -u root -p
查看數據庫
>show databases;
重設密碼,這里密碼設置為?root?
>set password = password('?root?');
退出數據庫
>exit;