目录
1.查看并卸载虚拟机自带的MySQL
2.上传MySQL压缩包并解压
3.rpm安装软件包
rpm -ivh mysql-community-common-5.7.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.28-1.el7.x86_64.rpm
4.工具软件下载
yum clean all
5.清理原来MySQL的日志数据
cd /var/lib/mysql && rm -rf ./*
6.初始化数据
mysqld --initialize --user=mysql
查看MySQL临时生成的root密码
cat /var/log/mysqld.log
7.配置my.cnf文件
vi /etc/my.cnf
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
8.启动MySQL服务
systemctl start mysqld
使用临时生成的密码登录数据库mysql -u root -p 密码: 3S#!ou-MfUt/
修改登录密码和授权远程登录
set password = password("123456");
update mysql.user set host='%' where user='root';
flush privileges
使用exit登出