CentOS 7之后的版本yum的默认源中使用MariaDB替代原先MySQL
下载源命令:wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
安装云库
yum localinstall -y mysql57-community-release-el7-7.noarch.rpm
安装mysql
yum install -y mysql-server
启动
systemctl start mysqld.service
默认密码保存在:
/var/log/mysqld.log
通过命令
grep 'temporary password' /var/log/mysqld.log
即可获得
2017-07-13T06:07:38.503321Z 1 [Note] A temporary password is generated for root@localhost: 6Wvplc)kWGuf
第一次登入需要修改密码,不然无法继续。默认的新密码需要包括大小写和数字还有特殊字符,可以通过在my.cnf中添加
validate_password=off来修改这一规则,然后重启mysql
systemctl restart mysqld.service
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
firewall-cmd --add-port=3306/tcp