如何在多实例基础上再添加一个mysql的实例
2016-10-10 15:04
716 查看
1)创建数据文件所需的目录
附件:http://down.51cto.com/data/2368234
# mkdir -p /data/3308/data # cp /data/3306/my.cnf /data/3308 # cp /data/3306/mysql /data/33082)配置权限
# chown mysql.mysql /data/3308 -R # chown root.root /data/3308/mysql # chmod 700 /data/3308/mysql3)修改数据配置文件及启动脚本
# sed -i 's/3306/3308/g' /data/3308/my.cnf # sed -i 's/server-id = 1/server-id = 8/g' /data/3308/my.cnf # cat my.cnf | grep id pid-file = /data/3308/mysql.pid server-id = 8 pid-file=/data/3308/mysqld.pid # sed -i 's/3306/3308/g' /data/3308/mysql # cd /application/mysql/scripts/ # ./mysql_install_db --datadir=/data/3308/data --basedir=/application/mysql --user=mysql # /data/3308/mysql start Starting MySQL... # echo $? 04)检查数据库的运行情况
# netstat -tunlp | grep 330* tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 4052/mysqld tcp 0 0 0.0.0.0:3307 0.0.0.0:* LISTEN 4048/mysqld tcp 0 0 0.0.0.0:3308 0.0.0.0:* LISTEN 5502/mysqld5)配置数据库开机自动启动
# echo "/data/3308/mysql start">>/etc/rc.local # tail -4 /etc/rc.local 显示的结果如下: # mysql multi instances startup /data/3306/mysql start /data/3307/mysql start /data/3308/mysql start6)初始化数据库
设置mysql初始密码: # mysqladmin -u root -S /data/3308/mysql.sock password 'redhat12345' # mysql -u root -S /data/3308/mysql.sock -predhat12345 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.5.32-log Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
附件:http://down.51cto.com/data/2368234
相关文章推荐
- python 9-1 如何使用函数装饰器,定义函数装饰器,用来生成一个原函数基础添加新功能的函数,替代原函数
- mysql如何添加一个表的外键 4000
- MySQL基础教程3-如何添加用户
- 如何手动添加一个数据库实例
- mysql如何添加一个表的外键
- MySQL系列之D-2------MySQL多实例添加一个实例
- mysql 基础-对一个已经编译好的mysqld,如何查看编译参数?如何看是32/64位环境编译的?如何确认mysqld程序依赖哪些库?
- 关于"如何让应用程序只有一个实例在运行"的孟宪会的解决方法的疑问
- 如何确保应用只有一个实例运行
- 如何解决 JMeter 通过 JDBC 访问 Oracle 和 MySQL 的问题 (留言中有 Test Plan 实例下载)
- 如何实现同一用户只能存在一个实例?
- 如何使应用程序只运行一个实例
- 如何只让Windows程序只启动一个实例,第二个实例启动只激活第一个实例
- 如何实现程序只有一个实例
- 如何添加一个自定义的columnstyles 到设计器中,以便在设计时直接使用他们?
- 正在学设计模式呵,转载一篇如何保证一个窗体的实例运行
- C#建立了一个windows程序,如何防止多个程序实例运行?
- 如何知道一个进程运行了多少个实例?
- 如何在一个基于对话框的程序中添加 Menu 菜单
- 如何解决 JMeter 通过 JDBC 访问 Oracle 和 MySQL 的问题 (留言中有 Test Plan 实例下载)