mysql5.7多实例安装

Deadly 提交于 2020-11-08 09:02:23

[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

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!