Preface
There are three ways to install MySQL: RPM installation, binary package installation, source package installation. These 3 various ways each have the characteristic, the main characteristic refer to the following table. In real-world applications, you can optimize based on the host environment you use, choose the best configuration values, and install customizations more flexibly. Visit the MySQL website http://dev.mysql.com/downloads/download the latest stable release version of the corresponding MySQL.
|
Rpm |
Binary |
Source |
| advantages |
Easy to install, suitable for beginners |
Installation is simple, can be installed in any path, flexibility, a single server can install multiple MySQL. |
in the actual installed operating system can be based on Requires custom compilation, the most flexible, the best performance, one server can install multiple MySQL. |
| Disadvantages |
1. you need to download the client and server side separately; 2. installation path is not flexible, the default path can not be modified, a set of servers can only install one MySQL. |
has been compiled, performance is not as good as the source code compiled, can not be flexibly customized compilation parameters. |
The installation process is more complex and the compilation time is long |
| File layout |
/usr/bin Client programs and Scripts /usr/sbin MySQL server /var/lib/mysql log file and database /usr/include/mysql include file /usr/lib/mysql library file /usr/share/mysql error message and character set file /usr/share/sql-bench Datum program |
bin Client programs and Mysqlid server data log files and databases doc document and Changelog include contains file lib library file Span style= "font-family:fangsong_gb2312; Color: #000000; " >scripts mysql_install_db script to install the system database Share/mysql error message file sql-bench Benchmark Program |
Bin client programs and scripts Include/mysql Include files Documents in Info Info format Lib/mysql Library file Libexec MySQL Server Share/mysql error Message File Sql-bench Benchmark program and CRASH-ME test Var Database and log files |
Binary installation
1. Create a MySQL user
Useradd-s/sbin/nologin-m MySQL
2. Create a directory to hold your data
Mkdir/data/mysql-pv
Chown-r Mysql:mysql/data/mysql
3. Installation
# tar zxf mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz-c/usr/local/# ln-sv/usr/local/mysql-5.6.26-linux-glibc2.5-x86_ 64/usr/local/mysql# chown-r mysql.mysql/usr/local/mysql/*# cd/usr/local/mysql # scripts/mysql_install_db-- Basedir=/usr/local/mysql--datadir=/data/mysql--user=mysql
4. Create a startup file
# Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld
5. Create a configuration file
# CP/USR/LOCAL/MYSQL/MY.CNF/ETC/MY.CNF
6. Modifying environment variables
# vim/etc/profileexport path= $PATH:/usr/local/mysql/bin
Rpm
MySQL Database installation method