怎么样安装多实例mysql数据库
本文主要给大家简单讲讲怎么样安装多实例MySQL数据库,相关专业术语大家可以上网查查或者找一些相关书籍补充一下,这里就不涉猎了,我们就直奔主题吧,希望怎么样安装多实例mysql数据库这篇文章可以给大家带来一些实际帮助。
创新互联主营晋源网站建设的网络公司,主营网站建设方案,app软件开发公司,晋源h5小程序设计搭建,晋源网站营销推广欢迎晋源等地区企业咨询
一、实验环境
系统: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 distributio
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 distributio
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数据库就先给大家讲到这里,对于其它相关问题大家想要了解的可以持续关注我们的行业资讯。我们的板块内容每天都会捕捉一些行业新闻及专业知识分享给大家的。
分享题目:怎么样安装多实例mysql数据库
网址分享:http://azwzsj.com/article/igsgoi.html