mysql5.6版本多配置文件安装实例
程序员文章站
2022-04-17 09:00:39
mysql5.6版本多配置文件安装实例
为新实例创建数据目录并赋权
#创建两个目录分别作为两个实例的数据目录
mkdir -p /data/application/mys...
mysql5.6版本多配置文件安装实例
为新实例创建数据目录并赋权
#创建两个目录分别作为两个实例的数据目录 mkdir -p /data/application/mysql-multi-instance/{mysql3307, mysql3308} #为两个实例的数据目录赋权,避免在初始化数据库时出错 chown mysql:mysql -R /data/application/mysql-multi-instance/{mysql3307, mysql3308}
使用mysql的mysql_install_db实例化数据库
./mysql_install_db --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3307 --user=mysql ./mysql_install_db --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3308 --user=mysql
编辑两个实例的配置文件
#这是3307实例的配置文件 [client] port = 3307 socket = /tmp/mysql3307.sock [mysql] no-auto-rehash [mysqld] user = mysql port = 3307 socket = /tmp/mysql3307.sock basedir = /data/application/mysql datadir = /data/application/mysql-multi-instance/mysql3307 [mysqldump] quick max_allowed_packet = 2M [mysqld_safe] log-error=/data/application/mysql-multi-instance/mysql3307/mysql_3307.err pid-file=/data/application/mysql-multi-instance/mysql3307/mysqld.pid
#这是3308实例的配置文件 [client] port = 3308 socket = /tmp/mysql3308.sock [mysql] no-auto-rehash [mysqld] user = mysql port = 3308 socket = /tmp/mysql3308.sock basedir = /data/application/mysql datadir = /data/application/mysql-multi-instance/mysql3308 [mysqldump] quick max_allowed_packet = 2M [mysqld_safe] log-error=/data/application/mysql-multi-instance/mysql3308/mysql_3308.err pid-file=/data/application/mysql-multi-instance/mysql3308/mysqld.pid
启动实例
mysqld_safe --defaults-file=/data/application/etc/mysql3307.cnf --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3307 --user=mysql & mysqld_safe --defaults-file=/data/application/etc/mysql3308.cnf --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3308 --user=mysql &
查看启动结果
#这里开启了默认的3306实例,所以有三个实例 root 6794 1 0 Oct26 ? 00:00:00 /bin/sh /data/application/mysql/bin/mysqld_safe --defaults-file=/data/application/mysql/my.cnf --basedir=/data/application/mysql --datadir=/data/application/mysqlData --user=mysql mysql 6902 6794 0 Oct26 ? 00:00:37 /data/application/mysql/bin/mysqld --defaults-file=/data/application/mysql/my.cnf --basedir=/data/application/mysql --datadir=/data/application/mysqlData --plugin-dir=/data/application/mysql/lib/plugin --user=mysql --log-error=/data/application/mysqlData/iZuf60tfg75y5orqql6pluZ.err --pid-file=/data/application/mysqlData/iZuf60tfg75y5orqql6pluZ.pid root 16375 11905 0 19:31 pts/3 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/data/application/etc/mysql3307.cnf --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3307 --user=mysql mysql 16560 16375 0 19:31 pts/3 00:00:00 /data/application/mysql/bin/mysqld --defaults-file=/data/application/etc/mysql3307.cnf --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3307 --plugin-dir=/data/application/mysql/lib/plugin --user=mysql --log-error=/data/application/mysql-multi-instance/mysql3307/mysql_3307.err --pid-file=/data/application/mysql-multi-instance/mysql3307/mysqld.pid --socket=/tmp/mysql3307.sock --port=3307 root 16605 11905 0 19:50 pts/3 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/data/application/etc/mysql3308.cnf --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3308 --user=mysql mysql 16789 16605 0 19:50 pts/3 00:00:00 /data/application/mysql/bin/mysqld --defaults-file=/data/application/etc/mysql3308.cnf --basedir=/data/application/mysql --datadir=/data/application/mysql-multi-instance/mysql3308 --plugin-dir=/data/application/mysql/lib/plugin --user=mysql --log-error=/data/application/mysql-multi-instance/mysql3308/mysql_3308.err --pid-file=/data/application/mysql-multi-instance/mysql3308/mysqld.pid --socket=/tmp/mysql3308.sock --port=3308
修改密码
mysqladmin -u root password -S /tmp/mysql3307.sock mysqladmin -u root password -S /tmp/mysql3308.sock
至此记录完毕
上一篇: 四川火锅鸡是什么?火锅和红烧鸡的结合
推荐阅读
-
LInux下安装MySQL5.6 X64版本步骤详解
-
MYSQL8.0.13免安装版配置教程实例详解
-
mysql5.6 绿色免安装版 安装详解
-
ubuntu mysql 5.6版本的删除/安装/编码配置文件配置
-
mysql5.6版本多配置文件安装实例
-
Windows系统安装配置MySQL5.6教程 超简单 解压版免安装直接使用
-
Mysql 8.0解压版下载安装以及配置的实例教程
-
windows下MySQL5.6版本安装及配置过程附有截图和详细说明_MySQL
-
MySQL5.6免安装版环境配置图文教程_MySQL
-
数据库——1、MySql安装(MySQL8.0.25版本与MySQL5.6版本一起使用)