温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

centos 6.5 一分钟安装mysql

发布时间:2020-07-21 01:50:07 来源:网络 阅读:432 作者:轻狂书生999 栏目: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



向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI