mysql6、7、8安装(centos7)
1.mysql5.6安装
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
service mysqld restart
service mysqld status
netstat -antup|grep 3306
mysql -u root
GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "xxxxx@mysql56";
flush privileges;
2.yum安装5.7版mysql
wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
yum localinstall mysql57-community-release-el7-11.noarch.rpm
yum install mysql-community-server
systemctl start mysqld
cat /var/log/mysqld.log 查看初始密码
登录mysql
mysql -uroot -p
修改root密码
SET PASSWORD = PASSWORD('XXxxx@2017'); # mysql7密码设置有复杂度要求
flush privileges;
3.mysql8安装
安装:
wget -c https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
rpm -ivh mysql80-community-release-el7-1.noarch.rpm
yum clear all
yum makecache
yum repolist all | grep mysql
yum install mysql-community-server
cat /var/log/mysqld.log | grep password
启动配置:
service mysqld restart
mysql -u root -p
set password="XXxx@2018";
ALTER USER "root"@"localhost" IDENTIFIED BY "XXxxx@mysql8";
CREATE USER 'xxbmm'@'%' IDENTIFIED BY 'XXxxx@mysql8';
grant all on *.* to 'xxxxx'@'%';
ALTER USER 'xxxxx'@'%' IDENTIFIED WITH mysql_native_password BY 'XXxxx@mysql8';