进入官网,下好LINUX的安装包
1.查看系统自带的Mariadb
rpm -qa|grep mariadb
2.卸载自带的Mariadb
rpm -e --nodeps mariadb-libs-5.5.64-1.el7.x86_64
3.创建目录
mkdir usr/local/mysql
4.创建MYSQL用户组 ,并吧用户组加到MYSQL
groupadd mysql
useradd -g mysql mysql
4.给MYSQL设置密码
passwd mysql
5.将安装包移动到/usr/local/mysql
mv mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar.tar /usr/local/mysql
6.解压安装包
tar -xvf mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar.tar
7.安装依赖
安装mysql所需要的依赖
yum install libaio
yum install perl
yum install net-tools
yum install perl-Data-Dumper.x86_64 perl-JSON -y
8.依次安装 community,libd,client,server
rpm -ivh mysql-community-common-5.7.28-1.el7.x86_64.rpm
rpm -ivh 对应的报名
9.查看MYSQL的状态)(刚启动时,会是关闭状态)
service mysqld status
10.启动MYSQL
service mysqld start
11.查看原始的MYSQL密码
Cat/var/log/mysqld.log | grep password
12.登录
mysql -u root -p
输入上一步得到的密码
13.进入MYSQL后修改初始密码
set password for root@localhost = password(‘PAWpaw123###’);
稍微要复杂一点的密码才可以通过