1.下载安装包
centos 6
wget https://repo.mysql.com/yum/mysql-5.7-community/el/6/x86_64/mysql-community-common-5.7.17-1.el6.x86_64.rpm
wget https://repo.mysql.com/yum/mysql-5.7-community/el/6/x86_64/mysql-community-libs-5.7.17-1.el6.x86_64.rpm
wget https://repo.mysql.com/yum/mysql-5.7-community/el/6/x86_64/mysql-community-client-5.7.17-1.el6.x86_64.rpm
wget https://repo.mysql.com/yum/mysql-5.7-community/el/6/x86_64/mysql-community-server-5.7.17-1.el6.x86_64.rpm
centos7
wget https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-common-5.7.17-1.el7.x86_64.rpm
wget https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-libs-5.7.17-1.el7.x86_64.rpm
wget https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-client-5.7.17-1.el7.x86_64.rpm
wget https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-server-5.7.17-1.el7.x86_64.rpm
2.安装
centos6
rpm -ivh mysql-community-common-5.7.17-1.el6.x86_64.rpm --force --nodeps
rpm -ivh mysql-community-libs-5.7.17-1.el6.x86_64.rpm --force --nodeps
rpm -ivh mysql-community-client-5.7.17-1.el6.x86_64.rpm --force --nodeps
rpm -ivh mysql-community-server-5.7.17-1.el6.x86_64.rpm --force --nodeps
centos7
rpm -ivh mysql-community-common-5.7.17-1.el7.x86_64.rpm --force --nodeps
rpm -ivh mysql-community-libs-5.7.17-1.el7.x86_64.rpm --force --nodeps
rpm -ivh mysql-community-client-5.7.17-1.el7.x86_64.rpm --force --nodeps
rpm -ivh mysql-community-server-5.7.17-1.el7.x86_64.rpm --force --nodeps
3.安装依赖插件
yum install libaio numactl -y
4.初始化
mysqld --initialize
5查看初始化密码,记录下来
cat /var/log/mysqld.log
oNThDvbjp9-+
6.编辑字符编码和严格模式
vim /etc/my.cnf
character_set_server=utf8
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
7.赋权限
chown mysql:mysql /var/lib/mysql -R
8.启动mysql
service mysqld start
9.初始登录设置密码
mysql -uroot -p
输入第5部记录的密码
set password=password('xxxx');
10.创建用户、赋权限、远程登录
create user 'root'@'%' identified by '123';
GRANT ALL PRIVILEGES ON *.* to 'root'@'%';
flush privileges;