zoukankan      html  css  js  c++  java
  • MySQL -2- 体系结构-多实例模块

    0、在已创建mysql,port=3306的数据库前提下

    需要删除/etc/.my.cnf再做以下操作 cp /etc/my.cnf /etc/my.cnf.3306

    1、mkdir -p /u02/data/{3307,3308,3309}/data
    2、chown -R mysql:mysql /u02/data/{3307,3308,3309}/data

    3、创建/etc/my.cnf文件(多实例情况下的my.cnf)

    [mysqld_multi]
    mysqld = /u02/app/mysql/bin/mysqld_safe
    mysqladmin = /u02/app/mysql/bin/mysqladmin
    #user = root
    #password ="root123"
    
    [mysqld3307]
    datadir = /u02/data/3307/data
    port = 3307
    socket = /tmp/mysql3307.sock
    #log-bin = /u02/data/3307/data/mysql-bin
    pid-file = /u02/data/3307/data/mysql_3307.pid
    log-error=/var/log/3307.log
    
    
    [mysqld3308]
    datadir = /u02/data/3308/data
    port = 3308
    socket = /tmp/mysql3308.sock
    #log-bin = /u02/data/3308/data/mysql-bin
    pid-file = /u02/data/3308/data/mysql_3308.pid
    log-error=/var/log/3308.log
    
    
    [mysqld3309]
    datadir = /u02/data/3309/data
    port = 3309
    socket = /tmp/mysql3309.sock
    #log-bin = /u02/data/3309/data/mysql-bin
    pid-file = /u02/data/3309/data/mysql_3309.pid
    log-error=/var/log/3309.log

    4.初始化,创建基础的数据库文件

    mysqld --initialize-insecure --user=mysql --datadir=/u02/data/3307/data --basedir=/u02/app/mysql
    mysqld --initialize-insecure --user=mysql --datadir=/u02/data/3308/data --basedir=/u02/app/mysql
    mysqld --initialize-insecure --user=mysql --datadir=/u02/data/3309/data --basedir=/u02/app/mysql

    5、启动多实例服务

    mysqld_multi start --启动全部实例
    mysqld_multi start 3307 --启动3307实例
    mysqld_multi start 3308 --启动3308实例
    start 3309 --启动3309实例
    若同时起3306时,/etc/my.cnf已被3306使用,此时多实例为/etc/mysqld_multi.cnf,则登陆时为
    mysqld_multti --defaults-extra-file=/etc/mysqld_multi.cnf start 3307

    6、初始化密码

    mysqladmin -uroot password root3307 -S /tmp/mysql3307.sock
    mysqladmin -uroot password root3308 -S /tmp/mysql3308.sock
    mysqladmin -uroot password root3309 -S /tmp/mysql3309.sock

    7、登录

    mysql -uroot -p -S /tmp/mysql3307.sock
    Enter password: root3307
    
    mysql> select * from mysql.user;
    mysql>show databases;
    

      

  • 相关阅读:
    博客园
    未释放的已删除文件
    ssh连接缓慢
    剑指 Offer 38. 字符串的排列
    剑指 Offer 37. 序列化二叉树
    剑指 Offer 50. 第一个只出现一次的字符
    剑指 Offer 36. 二叉搜索树与双向链表
    剑指 Offer 35. 复杂链表的复制
    剑指 Offer 34. 二叉树中和为某一值的路径
    剑指 Offer 33. 二叉搜索树的后序遍历序列
  • 原文地址:https://www.cnblogs.com/moox/p/11255541.html
Copyright © 2011-2022 走看看