多实例mysql数据库安装详解
2016-07-01 18:33
731 查看
一、实验环境
系统: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 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>
本文出自 “叫醒你的不是闹钟而是梦想” 博客,请务必保留此出处http://purify.blog.51cto.com/10572011/1795031
系统: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 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>
本文出自 “叫醒你的不是闹钟而是梦想” 博客,请务必保留此出处http://purify.blog.51cto.com/10572011/1795031
相关文章推荐
- [已解决]EnvironmentError: mysql_config not found
- mysql事务(2)
- MySQL 多实例详解
- MySQL 多实例详解
- Mysql错误处理
- Mysql显示行号
- 一些常用数据库操作在mysql及sql server中实现方式的差异
- Highstock+flask+mysql实现多线条动态刷新
- mysql之经典case when
- mysql-5.7.13-winx64解压版配置安装小结
- mysql 游标类型
- Mysql编码引起的Illegal mix of collations
- MYSQL随机取出20条数据
- mysql 5.7.13 winx32 安装步骤
- MYSQL嵌套查询
- mysql 视图创建及使用
- OS X EI Capitan 安装mysql-5.7.9
- 深入了解MySQL 5.5分区功能增强
- 详解 MySQL 中的 explain
- mysql索引总结----mysql 索引类型以及创建