1.下载MysqL源
wget http://dev.MysqL.com/get/MysqL57-community-release-el7-7.noarch.rpm
2.安装MysqL源
sudo rpm -ivh MysqL57-community-release-el7-7.noarch.rpm
3.安装MysqL-community-server
sudo yum install MysqL-community-server -y
4.重启MysqL
systemctl restart MysqLd
注:自动启动服务用 systemctl enable MysqL
5.查看临时密码
grep 'A temporary password' /var/log/MysqLd.log
2015-12-24T08:04:50.296020Z 1 [Note] A temporary password is generated for root@localhost: I(eKs9PyklP_
6.用临时密码登录MysqL并修改root密码,新增用户,打开远程访问
>MysqL -uroot -p
Enter password:
Welcome to the MysqL monitor. Commands end with ; or \g.
Your MysqL connection id is 15
Server version: 5.7.10 MysqL Community Server (GPL)
Copyright (c) 2000,2015,Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MysqL> alter user 'root'@'localhost' identified by ‘Abc123///';
Query OK,0 rows affected (0.00 sec)
MysqL> flush privileges;
MysqL> create user hadoop identified by ‘Abc123///‘
MysqL>grant all privileges on *.* to 'root'@'%' identified by ‘Abc123///' with grant option;
7.打开防火墙并重启防火墙,确认端口
sudo firewall-cmd --permanent --add-service MysqL
systemctl restart firewalld.service
iptables -L -n|grep 3306