mysql主

#!/bin/bash
#安装部署mysql
yum -y install mariadb mariadb-server &>/dev/null
echo “mariadb install ok!!!”
#假如我执行完脚本想执行第二次 但配置文件里已存在 我要删除后才能执行 下一遍
sed -i ‘/server/d’ /etc/my.cnf
sed -i ‘/log_bin/d’ /etc/my.cnf
sed -i ‘/relay_log/d’ /etc/my.cnf
#修改配置文件
sed -i ‘/symbolic-links=0/a log_bin=mysql-bin \n server_id=1 \n relay_log=relay-logs’ /etc/my.cnf
#重新启动
systemctl restart mariadb.service
#进入并授权 mysql
mysql -e “grant all on . to ‘tom’@’%’ identified by ‘123456’;”
#查看master状态
mysql -e “show master status”;

原创文章 167 获赞 6 访问量 4125

猜你喜欢

转载自blog.csdn.net/xiaowoniuwzx/article/details/105744913
今日推荐