配置(2):mysql8 主从搭建

前言

学习搭建mysql主从模式,在此记录。

 

配置

 Red Hat 4.8.5-36 4核 8g *3;

 mysqld 8.0.20

 

安装mysql

参考:https://blog.csdn.net/qq_38188762/article/details/100077051

下载镜像
 
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
 
安装镜像
 
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
 
安装MySQL服务
 
yum install mysql-server

设置权限

chown mysql:mysql -R /var/lib/mysql

初始化mysql

mysqld --initializa

查看状态
systemctl status mysqld.service
查看进程
ps -ef|grep mysql

启动/设置开机自启

systemctl start mysqld

 systemctl enable mysqld

 systemctl daemon-reload

      ps.这里报错Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.  

    vim /var/log/mysqld.log查看日志

 绕过权限登录

 mysqld --user=root --skip-grant-tables &

 修改密码(报错刷新下权限)

 alter user ‘root‘@‘%‘ identified with mysql_native_password by ‘123456‘;

 远程访问

 UPDATE user SET `Host` = ‘%‘ WHERE `User` = ‘root‘ LIMIT 1;

 刷新权限

 flush privileges;

  

 

 

配置(2):mysql8 主从搭建

上一篇:Docker 安装并部署Tomcat、Mysql8、Redis


下一篇:dedecms调用仿百度ask问答的问题SQL语句