centos 6.5 一分鐘安裝MySQL
按需求定制制作可以根據(jù)自己的需求進行定制,成都做網(wǎng)站、成都網(wǎng)站設(shè)計構(gòu)思過程中功能建設(shè)理應(yīng)排到主要部位公司成都做網(wǎng)站、成都網(wǎng)站設(shè)計的運用實際效果公司網(wǎng)站制作網(wǎng)站建立與制做的實際意義
手動執(zhí)行
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