mysql多实例安装方法

1.CentOS5.8 x86_64位 采用最小化安装,系统经过了基本优化篇
2.nginx版本:nginx-1.4.7
3.源码包存放位置:/home/oldboy/tools
4.源码包编译安装位置:/application/
5.已经安装了单实例的mysql,路径在/usr/local/mysql

一.mysql多实例启动设置
    1.新建目录:
        [[email protected] ~]# mkdir /data/{3306,3307}/data -p
        [[email protected] ~]# tree /data
        /data
        |-- 3306
        |   `-- data
        |-- 3307
        |   `-- data
    2.关闭单实例的mysql自动启
        [[email protected] 3307]# chkconfig --list mysqld
        mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off
        [[email protected] 3307]# chkconfig mysqld off ;
        [[email protected] 3307]# chkconfig --list mysqld
        mysqld          0:off   1:off   2:off   3:off   4:off   5:off   6:off
    3.上传启动和配置文件my.cnf,mysql启动脚本到对应的目录下面
        [[email protected] data]# cd 3306
        [[email protected] 3306]# ls
        data
        [[email protected] 3306]# rz
        rz waiting to receive.
        Starting zmodem transfer.  Press Ctrl+C to cancel.
        Transferring my.cnf...
          100%       1 KB       1 KB/sec    00:00:01       0 Errors  
        Transferring mysql...
          100%       1 KB       1 KB/sec    00:00:01       0 Errors
    4.修改/data目录的属主
        [[email protected] bin]# chown mysql:mysql /data
    5.增加mysql启动脚本的执行权限
        [[email protected] bin]# chmod 700 /data/3306/mysql
        [[email protected] bin]# ll /data/3306/mysql       
        -rwx------ 1 mysql mysql 1053 Apr 12  2012 /data/3306/mysql

[[email protected] bin]# chmod 700 /data/3307/mysql
    6.安装数据库
        [[email protected] bin]# mysql_install_db --datadir=/data/3307/data --user=mysql
        [[email protected] bin]# mysql_install_db --datadir=/data/3306/data --user=mysql
    7.设置mysql数据库的登陆密码
        [[email protected] 3306]# mysqladmin -uroot password ‘mybaby3307‘ -S /data/3307/mysql.sock
        [[email protected] 3306]# mysql -uroot -p -S /data/3307/mysql.sock
        Enter password:
        Welcome to the MySQL monitor.  Commands end with ; or \g.
        Your MySQL connection id is 2
        Server version: 5.1.73-log Source distributio
    8.安装过程报错处理方法:
        A.错误1
        InnoDB: Error: auto-extending data file ./ibdata1 is of a different size    #原因,ibdata1和配置文件的大小不对应
        InnoDB: 1024 pages (rounded down to MB) than specified in the .cnf file:
        InnoDB: initial 1088 pages, max 0 (relevant if non-zero) pages!
        InnoDB: Could not open or create data files.
        InnoDB: If you tried to add new data files, and it failed here,
        InnoDB: you should now edit innodb_data_file_path in my.cnf back
        B.错误2
        InnoDB: Database physically writes the file full: wait...
        InnoDB: Progress in MB: 100
        InnoDB: Error: all log files must be created at the same time.
        InnoDB: All log files must be created also in database creation.    #目录下的LOG文件时间ibdata1创建时间不一致
        InnoDB: If you want bigger or smaller log files, shut down the
        InnoDB: database and make sure there were no errors in shutdown.
        InnoDB: Then delete the existing log files. Edit the .cnf file
        InnoDB: and start the database again.
        141027 10:42:26 [ERROR] Plugin ‘InnoDB‘ init function returned error.
        141027 10:42:26 [ERROR] Plugin ‘InnoDB‘ registration as a STORAGE ENGINE failed.
        141027 10:42:26 [ERROR] Unknown/unsupported table type: InnoDB
        141027 10:42:26 [ERROR] Aborting

处理方法:
            删除ibdata1,ip_*的log,启动mysql正常
            [[email protected] data]# rm ibdata1
            rm: remove regular file `ibdata1‘?

[[email protected] data]# rm ib*
            rm: remove regular file `ibdata1‘?
            [[email protected] data]# rm ib* -f
            [[email protected] data]# ll
            total 8
            drwx------ 2 mysql root 4096 Oct 27 08:44 mysql
            drwx------ 2 mysql root 4096 Oct 27 08:44 test

时间: 2024-08-04 12:09:29

mysql多实例安装方法的相关文章

linux下mysql多实例安装(转)

转自:http://www.cnblogs.com/xuchenliang/p/6843990.html 1.MySQL多实例介绍 1.1.什么是MySQL多实例 MySQL多实例就是在一台机器上开启多个不同的服务端口(如:3306,3307),运行多个MySQL服务进程,通过不同的socket监听不同的服务端口来提供各自的服务:: 1.2.MySQL多实例的特点有以下几点 1:有效利用服务器资源,当单个服务器资源有剩余时,可以充分利用剩余的资源提供更多的服务. 2:节约服务器资源 3:资源互相

Windows下MySQL多实例安装/主从复制/重置密码

Windows创建MySQL多实例 安装MYSQL和实例1 运行mysql-installer-community-5.7.16.0.msi 选择组件 MySQL Server 5.7.16 – X64 MySQL Utilities 1.6.4 – X64 MySQL Workbench 6.3.7 – X64 执行安装 配置端口3306 Windows Service Name设置为MYSQL 复制实例 将C:\ProgramData\MySQL\MySQL拷贝为MYSQL1和MYSQL2文

MySQL多实例安装

    MySQL数据库(一) 作者:Jack 归档:学习笔记 2017/6/19 目  录 MySQl数据库(一)... 3 第1章概述:... 4 1.1 MySQL介绍:... 4 1.2 MariaDB数据库的诞生背景介绍... 4 1.3 MySQL多实例介绍... 5 1.3.1 什么是MySQL多实例... 5 1.3.2 MySQL多实例的作用与问题... 6 1.4 MySQL多实例的生产应用场景... 7 第2章关系型数据库与非关系型数据库... 8 2.1 关系型数据库..

MySQL数据库多种安装方法及企业级安装实践

本文来自老男孩老师第三本书籍著作<老男孩的MySQL私房菜>第三章内容分享! 3.1 MySQL数据库的安装方法及选择 在当今的互联网企业里,MySQL数据库大多运行在Linux系列操作系统上,当然,你也可以运行在Windows/Unix等商业操作系统上,本书主要以国内互联网公司应用最多的数据库服务操作系统--CentOS6最新版(6.8)x86_64 Linux系统为例进行讲解,使用其他系统的读者同样可以从本书受益! 即使是在CentOS 6 x86_64 Linux系统环境下,若应用场景不

03 :mysql模型 和 mysql多实例安装

MySQL 简单知识-------------------------------------------------------------------------------------------------------------- 一.mysql是C/S模型结构,即:client (客户端)+ server(服务器)  二.应用程序如何连接到mysql: 1.TCP/IP 方式连接数据库mysql -uadmin -p123 -h 10.0.0.51 -P 3306 可以证明:(1)数

MySQL多实例安装配置

MySQL多实例安装配置 一.基本概念 MySQL多实例就是,在一台机器上开启多个不同的服务端口(如:3306,3307,3308...),运行多个MySQL服务进程,这些服务进程通过不同的socket监听不同的端口提供服务. MySQL可以共用一套安全程序,使用不同的my.cnf配置文件,启动程序,数据文件. 逻辑上是独立的,但是一个实例过载过高的时候会对其他造成影响. MySQL多实例的作用与问题: 1.有效利用服务器资源 2.节约服务器资源 3.资源互相抢占问题 当某个服务实现并发生很高的

【Vegas原创】Mysql绿色版安装方法

原文:[Vegas原创]Mysql绿色版安装方法 所谓的绿色版,就是没有installer的MySQL,完全需要靠人工来操作,好处是,重装系统后,只要再做一次本次配置,即可使用. 具体操作方法: 1,设置系统环境变量, 在Path中添加 D:\mysql\bin 2,修改my-small.ini文件内容,添加以下内容 basedir=D:\mysql datadir=D:\mysql\data 修改后,另存为my.ini 3.安装MySQL的服务,服务名自己定义为MySQL. 1).进入DOS窗

Mysql快速配置安装方法

一. 前言 由于mysql 5.5.7之后使用cmake编译.本篇简单介绍mysql的安装和配置. 二. 环境准备 1.操作系统 CentOS 6.4 x86_64 2.软件版本 mysql-5.5.37   #下载地址:http://dev.mysql.com/downloads/file.php?id=451429 ,需要申请oracle账号才能下载. 3.需要安装的依赖包 cmake gcc gcc-c++ ncurses-devel bison openssl-devel 4. 安装过程

centos下mysql多实例安装3306、3307实例(2014-10-15)

背景说明 mysql的安装方法有多种,如二进制安装.源码编译安装.yum安装等.yum安装只能安装mysql 5.1 版本:源码安装编译的过程比较长,若没有对源码进行修改且要求使用mysql较高版本,建议使用二进制安装.本文以二进制安装mysql,且使用mysqld_mutil进行mysql多实例管理. 是否安装了mysql 首先查看下服务器中是否有安装mysql,若端口被占用,则需要选择其他端口. 下载mysql cd /usr/src wget http://cdn.mysql.com/Do