linux中yum安装mysql方式


安装mysql

yum install -y wget
wget https://repo.mysql.com//mysql80-community-release-el7-6.noarch.rpm
rpm -ivh mysql80-community-release-el7-6.noarch.rpm
# 下面这行报错
yum install -y mysql-server
# 解决办法
vim /etc/yum.repos.d/mysql-community.repo
将gpgcheck均修改为0
# systemctl start/status/restart/stop/enable/disable mysqld

启动mysql服务

systemctl start mysqld

登录MYSQL

mysql -uroot -pJsq123456...

开机自启动

systemctl enable mysqld

修改密码

alter user 'root'@'localhost'IDENTIFIED BY 'Jsq123456...';
flush privileges;