前面讲了mysql rpm安装包的安装方法,本文学习下二进制安装,其实二进制安装更简单,二进制是已经被编译过的代码,可以直接解压配置后使用,总结其特点就是:
1.安装简单
2. 可以指定安装目录,比较灵活
3.一台服务器上可以安装多个MYSQL
但是存在问题是,已经编译过,性能显然不如源码编译安装的好,也不能灵活定制编译参数,代码已经被编译过,将其解压到一个目录下即可以看到其安装包中文件,具体文件目录保护如下内容:
Directory
Contents of Directory
bin,scripts
mysqld server, client and utility programs
data
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
这样就完成了安装啦,可以看到主要还是用户权限问题需要配置好。