安装多实例mysql_多实例mysql数据库安装详解

一、实验环境

系统:cetos6.5

软件:mysql-5.5.32.tar.gz

二、实验步骤

1.1 安装cmake软件

tar xf cmake-2.8.8.tar.gz

cd cmake-2.8.8

./configure

gmake

gmake install

1.2 创建用户和组及其安装mysql依赖包

groupadd mysql

useradd mysql -s /sbin/nologin -M msyql

yum -y install ncurses-devel

1.3 解压编译安装mysql

tar xf mysql-5.5.32.tar.gz

cd mysql-5.5.32.tar.gz

cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32 \

-DMYSQL_DATADIR=/application/mysql-5.5.32/data \

-DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \

-DENABLED_LOCAL_INFILE=ON \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_FEDERATED_STORAGE_ENGINE=1 \

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \

-DWITHOUT_PARTITION_STORAGE_ENGINE=1 \

-DWITH_FAST_MUTEXES=1 \

-DWITH_ZLIB=bundled \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_READLINE=1 \

-DWITH_EMBEDDED_SERVER=1 \

-DWITH_DEBUG=0

make && make install

1.4 配置环境变量写入/etc/profile文件中

PATH="/application/mysql/bin:$PATH"

1.5 创建多实例目录启动脚本配置文件及其授权

/data/

├── 3306

│   ├── data

│   ├── my.cnf

│   └── mysql

└── 3307

├── data

├── my.cnf

└── mysql

chown -R mysql.mysql /data/

find /data/ -type f -name "mysql"|xargs chmod +x

/data/3306/mysql start  ---启动mysql进程

/data/3307/mysql start  ---启动mysql进程

1.6 通过socket多实例方式登录mysql

mysql -S /data/3306/mysql.sock

mysql -S /data/3307/mysql.sock

1.7 修改密码

mysqladmin -uroot -S /data/3306/mysql.sock password '123'

mysqladmin -uroot -S /data/3307/mysql.sock password '123'

1.8 改密码后的登录方式

mysql -uroot -p -S /data/3306/mysql.sock

mysql -uroot -p -S /data/3307/mysql.sock

1.9 实现登录成功

~]#mysql -uroot -p -S /data/3306/mysql.sock

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.5.32 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.

mysql>

~]#mysql -uroot -p -S /data/3307/mysql.sock  Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.5.32 Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值