数据库
首页 > 数据库> > MyCat专题(一)-CentOS7在线安装MySql

MyCat专题(一)-CentOS7在线安装MySql

作者:互联网

1.环境准备

准备三台centos7服务器:
在这里插入图片描述

主机名 IP地址
CentOS1 192.168.70.129
CentOS2 192.168.70.128
CentOS1 192.168.70.130

centos7修改hostname

[root@centos7 ~]$ hostnamectl set-hostname CentOS1       # 使用这个命令会立即生效且重启也生效
[root@centos7 ~]$ hostname                                                 # 查看下
CentOS1
[root@centos7 ~]$ vim /etc/hosts                                           # 编辑下hosts文件, 给127.0.0.1添加hostname
[root@centos7 ~]$ cat /etc/hosts                                           # 检查
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 CentOS1
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

另外两台一样设置!

2.CentOS7在线安装MySql

CentOS1,CentOS2这两台服务器安装MySql,后期方便进行MyCat相关实验

检测是否已经安装了mariadb

yum install -y mariadb-server

下载完成后启动服务器

systemctl start mariadb.service

设置登录密码

/usr/bin/mysqladmin -u root password "123"

重启

systemctl restart mariadb.service

登录mysql服务器

mysql -u root –p

输入密码

123

开启远程访问

grant all privileges on *.* to 'root' @'%' identified by '123';
flush privileges;	

设置mysql的服务随着系统的启动而启动

systemctl enable mariadb.service

设置mysql的服务随着系统的启动而启动

systemctl enable mariadb.service

关闭服务器防火墙

#停止firewall
systemctl stop firewalld.service
 #禁止firewall开机启动
systemctl disable firewalld.service

也可以将mysql端口加入得到防火墙中,开启访问

测试连接
在这里插入图片描述
在这里插入图片描述

标签:centos7,service,MyCat,CentOS7,systemctl,CentOS1,MySql,mariadb,root
来源: https://blog.csdn.net/BruceLiu_code/article/details/104691820