centos 6.5 一分钟安装mysql

前端之家收集整理的这篇文章主要介绍了centos 6.5 一分钟安装mysql前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

centos 6.5 一分钟安装MysqL

手动执行

wget https://dev.MysqL.com/get/MysqL57-community-release-el6-9.noarch.rpm

rpm -Uvh MysqL57-community-release-el6-9.noarch.rpm

yum install MysqL-community-server

service MysqLd start

iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

grep 'temporary password' /var/log/MysqLd.log

MysqL -uroot -p #输入过滤出来的密码

set global validate_password_policy=0; #修改密码的复杂度

set global validate_password_length=6; #修改密码的长度

ALTER USER 'root'@'localhost' IDENTIFIED BY 'abc123'; 修改密码



一键安装脚本

vim auto_install_MysqL.sh


#!/bin/bash


yum install -y wget

wget https://dev.MysqL.com/get/MysqL57-community-release-el6-9.noarch.rpm

rpm -Uvh MysqL57-community-release-el6-9.noarch.rpm

yum clean all

sleep 2

yum install MysqL-community-server -y

/etc/init.d/MysqLd start

chkconfig --level 2345 MysqLd on

for i in `grep 'temporary password' /var/log/MysqLd.log| awk -F": " '{print $2}'`;

do

MysqL -uroot -p$i -e "set global validate_password_policy=0;" -b --connect-expired-password

MysqL -uroot -p$i -e "set global validate_password_length=6;" -b --connect-expired-password

MysqL -uroot -p$i -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'abc123';" -b --connect-expired-password

/usr/bin/MysqLadmin -u root -p$i password 'abc123' -b --connect-expired-password

MysqL -uroot -p"abc123" -e "show databases;"

echo "MysqL is install ok"

done

service MysqLd restart

iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

service iptables save

/etc/init.d/iptables restart

原文链接:https://www.f2er.com/centos/375987.html

猜你在找的CentOS相关文章