Mysql下载网址→下载地址
1.选择对应Mysql版本和安装系统与是否是64位
2.将压缩包移到Linux虚拟机上并解压
解压后目录
执行 rpm -ivh mysql-community-server-5.7.30-1.el7.x86_64.rpm --force --nodeps
执行 rpm -ivh mysql-community-client-5.7.30-1.el7.x86_64.rpm --force --nodeps
3.使用命令启动mysql并查看状态
systemctl start mysqld.service 启动
service mysqld status 查看状态
4.查看初始化密码并修改密码
grep "password" /var/log/mysqld.log
5.7版本修改密码想设置123456这种必须执行下面命令
set global validate_password_policy=0;
set global validate_password_length=1;
然后修改密码
alter user 'root'@'localhost' identified by '新密码';
5.设置开机自启动和远程访问连接
systemctl enable mysqld
登录mysql
systemctl enable mysqld
输入 GRANT ALL ON *.* TO admin@'localhost' IDENTIFIED BY 'admin' WITH GRANT OPTION;
然后刷新权限 flush privileges;