centos6.5一分钟安装mysql-成都快上网建站

centos6.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


网站栏目:centos6.5一分钟安装mysql
文章出自:http://kswjz.com/article/jecdpd.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流