標籤:save 5.7 soc make efi rom mat port 登入
1 參考文檔
https://dev.mysql.com/doc/refman/5.7/en/source-installation.html
https://dev.mysql.com/doc/refman/5.7/en/installing-source-distribution.html
https://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html
2 安裝
2.1 開啟防火牆3306連接埠
$ sudo /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT$ sudo service iptables save
2.2 建立mysql使用者
$ groupadd mysql$ useradd -r -g mysql -s /bin/false mysql
2.2 下載mysql和boost庫(對應版本高於或低於這個版本都有問題) https://dev.mysql.com/doc/refman/5.7/en/source-installation.html
$ wget http://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz$ wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.20.tar.gz
安裝
$ tar zxvf boost_1_59_0.tar.gz$ mv boost_1_59_0 /usr/local/boost$ tar zxvf mysql-5.7.20.tar.gz && cd mysql-5.7.20/ && mkdir bld && cd bld/$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DDOWNLOAD_BOOST=OFF -DWITH_BOOST=/usr/local/boost -DMYSQL_TCP_PORT=3306 ..$ make && make install$ mkdir /opt/mysql && mkdir /opt/mysql/data && mkdir /opt/mysql/log && touch /opt/mysql/log/mariadb.log$ chown -R mysql:mysql /opt/mysql
設定檔調整
$ vi /etc/my.cnf
[mysqld]datadir=/opt/mysql/datasocket=/tmp/mysql.sock# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# Settings user and group are ignored when systemd is used.# If you need to run mysqld under a different user or group,# customize your systemd unit file for mariadb according to the# instructions in http://fedoraproject.org/wiki/Systemd# 忽略大小寫配置lower_case_table_names=1log-bin=mysql-binbinlog-format=ROWserver-id=1[mysqld_safe]log-error=/opt/mysql/log/mariadb.logpid-file=/tmp/mariadb.pid## include all files from the config directory#!includedir /etc/my.cnf.d
初始化mysql 系統資料表
$ /usr/local/mysql/bin/mysqld --initialize --user=mysql
*************************************************************************************
[Note] A temporary password is generated for [email protected]: a5goRy5Yez/t
擷取臨時密碼:a5goRy5Yez/t
*************************************************************************************
啟動
$ /usr/local/mysql/bin/mysqld_safe --user=mysql &
開啟SSL
$ /usr/local/mysql/bin/mysql_ssl_rsa_setup
登入 MySQL
$ /usr/local/mysql/bin/mysql -u root -p# 修改root初始密碼mysql> ALTER USER ‘root‘@‘localhost‘ identified by ‘[email protected]‘;# 允許root外部存取mysql> use mysqlmysql> GRANT ALL ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘[email protected]‘;
配置自啟動
$ cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql.server$ chmod 755 /etc/init.d/mysql.server$ chkconfig --add mysql.server$ chkconfig --list
Linux下mysql-5.7.20安裝