Environment: CentOS7
Software: MySQL5.6.26
1 Download MySQL source package
wget http://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.10/zabbix-2.2.10.tar.gz
2 Unzip the downloaded file to the/usr/local directory and modify the folder name to MySQL
TAR-ZXVF mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz-c/USR/LOCALMV Mysql-5.6.26-linux-glibc2.5-x86_64/mysql
3 Creating MySQL users and user groups
Useradd mysql-s/sbin/nologin
4 Create MySQL database directory and give permissions to MySQL users
Mkdir-p/data/mysqlchown-r mysql:mysql/data/mysqlchown-r Mysql:mysql/usr/local/mysql
5 Enter/usr/local/mysql directory to initialize MySQL
./scripts/mysql_install_db--user=mysql--datadir=/data/mysql
6 Back up the system's own MY.CNF file, and then move the default profile in the MySQL decompression directory
Mv/etc/my.cnf/etc/my.cnf.bakcp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf
7 Modify MY.CNF File
Datadir=/data/mysqlport=3306socket=/tmp/mysql.sock
8 Copy the Mysql.server file below the extracted directory to/etc/init.d/mysqld
Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqldchmod 755/etc/init.d/mysqldvi/etc/init.d/ Mysqlddatadir=/data/mysql #修改数据库目录文件
9 starting the MySQL service
Service mysqld startusage:mysqld {start|stop|restart|reload|force-reload|status} [MySQL Server options]
10 Configuring the environment variables for MySQL
echo "path= $PATH:/usr/local/mysql/bin" >>/etc/profilesource/etc/profile
11 Log in to MySQL
[Email protected] ~]# Mysql-uroot-penter password:welcome to the MySQL monitor. Commands End With; or \g.your MySQL connection ID is 2Server version:5.6.26 mysql Community Server (GPL) Copyright (c), Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql>
Installation Complete
This article is from the "Watch the world on the shoulders of Giants" blog, please be sure to keep this source http://lixiaotao.blog.51cto.com/985722/1692864
CentOS 7 + MySQL