[root@vhost1]# cd /opt/source
[root@vhost1]#ls
mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
[root@vhost1]# tar -zxvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
[root@vhost1]#ln -s /opt/source/mysql-5.7.21-linux-glibc2.12-x86_64 /usr/local/mysql
[root@vhost1]#groupadd -g 500 mysql
[root@vhost1]#useradd -r -g mysql -u 500 -s /bin/false mysql
[root@vhost1]#cd /usr/local/
[root@vhost1]#chown -R mysql.mysql mysql
创建3306端口实例
[root@vhost1]#mkdir -p /data/mysql_3306/{data,logs,run,tmp}
[root@vhost1]#cd /data/mysql_3306/logs
[root@vhost1]#touch mysql_error.log
[root@vhost1]#chown -R mysql.mysql /data/mysql_3306/
[root@vhost1]#vi /data/mysql_3306/my.cnf
初始化mysql
/usr/local/mysql/bin/mysqld --defaults-file=/data/mysql_3306/my.cnf --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql_3306/data
启动实例:
/usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql_3306/my.cnf --user=mysql
创建3307端口实例
[root@vhost1]#mkdir -p /data/mysql_3307/{data,logs,run,tmp}
[root@vhost1]#cd /data/mysql_3307/logs
[root@vhost1]#touch mysql_error.log
[root@vhost1]#chown -R mysql.mysql /data/mysql_3307/
[root@vhost1]#vi /data/mysql_3307/my.cnf
初始化mysql
/usr/local/mysql/bin/mysqld --defaults-file=/data/mysql_3307/my.cnf --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql_3307/data
启动实例:
/usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql_3307/my.cnf --user=mysql