前文已述,因为需要测试mysql的主从配置方案,所以要安装多个mysql。这次是在ubuntu kylin 14.10上安装多个mysql 5.7.14。

系统环境:ubuntu kylin 14.10,64位系统
mysql版本:5.7.14社区版
mysql下载地址:http://dev.mysql.com/downloads/mysql/,选择 Linux - Generic,下载612.9M的mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz
mysql官方安装文档:http://dev.mysql.com/doc/refman/5.7/en/binary-installation.html1.按照官方安装文档进行即可,只是一些shell命令做了修改,对ubuntu来说,大部分命令都需要在前面增加sudo

shell> sudo groupadd mysql
shell> sudo useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> sudo tar -zxvf /path/to/mysql-VERSION-OS.tar.gz

shell> sudo mv mysql-5.7.14-linux-glibc2.5-x86_64 mysql-5.7.14-linux-glibc2.5-x86_64-3306 #将mysql的目录改了一下名
shell> sudo ln -s mysql-5.7.14-linux-glibc2.5-x86_64-3306 mysql-3306
shell> cd mysql-3306
shell> sudo mkdir mysql-files
shell> sudo chmod 750 mysql-files
shell> sudo chown -R mysql:mysql .
shell> sudo cp support-files/my-default.cnf ./my.cnf #copy一份my.cnf

接着编辑my.cnf,打开basedir,datadir,port等项,按如下配置:
basedir = /usr/local/mysql-3306
datadir = /usr/local/mysql-3306/data
port = 3306
server_id = 11

然后开始初始化3306端口上的mysql:
shell> sudo bin/mysqld --defaults-file=/usr/local/mysql-3306/my.cnf --initialize --user=mysql
2016-07-29T15:38:48.896585Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-07-29T15:38:48.896672Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2016-07-29T15:38:48.896682Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2016-07-29T15:38:50.498675Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-07-29T15:38:50.890849Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-07-29T15:38:51.062752Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 8c708a13-55a2-11e6-835e-a0481ced538c.
2016-07-29T15:38:51.088854Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-07-29T15:38:51.090179Z 1 [Note] A temporary password is generated for root@localhost: pJLwjf%q;1t)

shell> sudo bin/mysql_ssl_rsa_setup --defaults-file=/usr/local/mysql-3306/my.cnf
Generating a 2048 bit RSA private key
.........+++
.......................+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
..........+++
..............................................................+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
................................................+++
........................................+++
writing new private key to 'client-key.pem'
-----

shell> sudo chown -R root .
shell> sudo chown -R mysql data mysql-files
shell> sudo bin/mysqld_safe --user=mysql & #启动mysql,在后台运行
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

2.开始登录mysql进行相关操作

/usr/local/mysql-3306> bin/mysql -uroot -p
注意在执行bin/mysqld初始化时,在命令行最后的提示中给出了一个临时口令,输入之后即可登录。登录mysql之后,要求立即修改密码,否则不能进行任何操作。执行下面的命令修改'root'@'localhost'的密码:

mysql> SET PASSWORD = PASSWORD('your new password');
mysql> ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
mysql> flush privileges;

为了可以远程登录,增加一个'root'@'%'账号:

复制代码 代码如下:mysql> grant all privileges on *.* to 'root'@'%' identified by 'your new password' with grant option;

3.按照上面的办法,继续解压安装mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz,并且配置为3307,3308,3309端口,就可以安装多个mysql了。

精彩专题分享:mysql不同版本安装教程 mysql5.7各版本安装教程

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

标签:
mysql5.7.14,mysql5.7,ubuntu,kylin,14.10

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无争山庄资源网 Copyright www.whwtcm.com

评论“ubuntu kylin 14.10下多个mysql 5.7.14安装教程”

暂无“ubuntu kylin 14.10下多个mysql 5.7.14安装教程”评论...

稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!

昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。

这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。

而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?