前面講了mysql rpm安裝包的安裝方法,本文學習下二進制安裝,其實二進制安裝更簡單,二進制是已經被編譯過的代碼,能夠直接解壓配置後使用,總結其特色就是:html
1.安裝簡單mysql
2. 能夠指定安裝目錄,比較靈活sql
3.一臺服務器上能夠安裝多個MYSQLshell
可是存在問題是,已經編譯過,性能顯然不如源碼編譯安裝的好,也不能靈活定製編譯參數,代碼已經被編譯過,將其解壓到一個目錄下便可以看到其安裝包中文件,具體文件目錄保護以下內容:服務器
Directoryide |
Contents of Directory性能 |
bin, scriptsspa |
mysqld server, client and utility programsorm |
dataserver |
Log files, databases |
docs |
MySQL manual in Info format |
man |
Unix manual pages |
include |
Include (header) files |
lib |
Libraries |
share |
Miscellaneous support files, including error messages, sample configuration files, SQL for database installation |
解壓即安裝:
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz shell> ln -s full-path-to-mysql-VERSION-OS mysql
比起RPM安裝包來說,二進制包安裝須要手工創建用戶:
shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql shell> mkdir mysql-files
shell> chmod 750 mysql-files
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql # Before MySQL 5.7.6
shell> bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and up
shell> bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and up
shell> chown -R root .
shell> chown -R mysql data mysql-files
shell> bin/mysqld_safe --user=mysql & # Next command is optional shell> cp support-files/mysql.server /etc/init.d/mysql.server
這樣就完成了安裝啦,能夠看到主要還是用戶權限問題須要配置好。