您好,登錄后才能下訂單哦!
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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。