Linux下mysql-5.7.20安裝

來源:互聯網
上載者:User

標籤: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安裝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.