MySQL binary installation, only need to decompress, do not need cmake/configure,make,make install
[Email protected] tools]# pwd
/home/yang/tools
[[email protected] tools]# Groupadd MySQL
[Email protected] tools]# useradd-s/sbin/nologin-g mysql-m MySQL
1. Install MySQL in binary mode
[Email protected] tools]# TAR-XF mysql-5.5.54-linux2.6-x86_64.tar.gz
[Email protected] tools]# MV mysql-5.5.54-linux2.6-x86_64/application/mysql-5.5.54 #移动并改名目录
2. Create a soft link
[Email protected] tools]# ln-s/application/mysql-5.5.54//application/mysql #设置软连接
[Email protected] tools]# ls-l/application/#查看mysql软链接
Total 8
lrwxrwxrwx. 1 root root 2 11:58 mysql--/application/mysql-5.5.54/
Drwxr-xr-x. Root root 4096 Mar 2 11:53 mysql-5.5.54
Current LNMP integration environment, MySQL database and nginx on a server, if MySQL and Nginx is not on a server, Nginx server MySQL database package only need to extract moved to the/application directory, You can change the name to MySQL, and do not set the following test initialization.
In a non-integrated LNMP environment (and MySQL and Nginx not on a single server), when compiling PHP environment, also need MySQL database environment, but the high version of PHP, For example, 5.3 version above, built-in PHP required MySQL program, therefore, for such a version will not need to install MySQL software on the server, the value needs to compile PHP when specifying the relevant parameters, the PHP compiler parameter is--with-mysql= Mysqlnd, which indicates that the PHP program will call the built-in MySQL library at compile time.
3. Initialize the MySQL configuration file my.cnf
[Email protected] tools]# Cd/application/mysql
[Email protected] mysql]# ls-l support-files/*.cnf
-rw-r--r--. 1 7161 31415 4691 Nov 00:10 support-files/my-huge.cnf
-rw-r--r--. 1 7161 31415 19759 Nov 00:10 support-files/my-innodb-heavy-4g.cnf
-rw-r--r--. 1 7161 31415 4665 Nov 00:10 support-files/my-large.cnf
-rw-r--r--. 1 7161 31415 4676 Nov 00:10 support-files/my-medium.cnf
-rw-r--r--. 1 7161 31415 2840 Nov 00:10 support-files/my-small.cnf
[Email protected] mysql]#/BIN/CP support-files/my-small.cnf/etc/my.cnf #因为是测试环境, So choose the parameter configuration small MY-SMALL.CNF configuration template, if the production environment can choose more advanced configuration files according to the hardware
MY-MEDIUM.CNF ==>my-small.cnf==>my-large.cnf==>my-huge.cnf==>my-innodb-heavy-4g.cnf #对硬件的要求从低到高依次为
[email protected] mysql]# Yum install Libaio
[Email protected] mysql]#/application/mysql/scripts/mysql_install_db--basedir=/application/mysql--datadir=/ application/mysql/data/--user=mysql #初始化数据库
[email protected] mysql]# CP support-files/mysql.server/etc/init.d/mysqld #拷贝MYSQL启动脚本到MySQL命令行
[Email protected] mysql]# sed-i ' s#/usr/local/mysql#/application/mysql#g '/application/mysql/bin/mysqld_safe/etc/ Init.d/mysqld
[[email protected] mysql]#/etc/init.d/mysqld start
Starting MySQL. success!
[Email protected] mysql]# NETSTAT-TULNP | grep 3306
TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 9020/mysqld
Set up MySQL boot from boot
[Email protected] mysql]# chkconfig--add mysqld
[Email protected] mysql]# chkconfig mysqld on
[Email protected] mysql]# chkconfig--list mysqld
Mysqld 0:off1:off2:on3:on4:on5:on6:off
LNMP-----mysql installation----MYQL binary installation