Centos 7安装MySQL Community Server 8.0.15
1、安装包下载
Red Hat Enterprise Linux 7 / Oracle Linux 7 (x86, 64-bit), RPM Bundle
https://dev.mysql.com/downloads/mysql/
windows下载(下载后上传至服务器):
centos下载(wget):
https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar
wget "https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar"
解压下载文件(tar)
tar -xvf mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar
2、安装
rpm -ivh mysql-community-common-8.0.15-1.el7.x86_64.rpm
rpm -qa | grep mariadb
rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
rpm -ivh mysql-community-libs-8.0.15-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.15-1.el7.x86_64.rpm
yum install libaio
rpm -ivh mysql-community-server-8.0.15-1.el7.x86_64.rpm
3、启动
systemctl start mysqld.service
查看初始密码
vim /var/log/mysqld.log
:q
登录
mysql -uroot -p
修改密码
alter user 'root'@'localhost' identified by '新密码';
密码策略查看与修改
show variables like 'validate_password%';
mysql> set global validate_password.policy=0;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password.length=1;
Query OK, 0 rows affected (0.00 sec)
创建新用户
create user '用户名'@'%' identified with mysql_native_password by '用户名密码';
用户授权
grant all privileges on *.* to '用户名'@'%' with grant option;