阿里云服务器安装配置配置MySQL

1.先更新软件 输入

    yum -y update

2.下载MySql安装包

    rpm -ivh http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

3.安装MySql

    yum install -y mysql-server

安装成功最后出现complete!

4.设置开机启动

    systemctl enable mysqld.service

5.检查是否设置开机启动成功

    systemctl list-unit-files | grep mysqld

6.启动mysql

    systemctl start mysqld.service

尝试查看默认密码没有成功,选择先跳过密码登录

7.先停mysql服务

service mysqld stop

8.跳过密码登录

#/usr/bin/mysqld_safe --skip-grant-tables

9.启动服务

systemctl start mysqld.service

10.无密码登录

 mysql -u root

11.修改密码

 set password for root@localhost='12345';

出现报错:The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

12.刷新权限表

flush privileges;

13.重新修改密码

set password for root@localhost='12345';

修改成功,可以使用修改后密码登录mysql

posted @ 2019-09-24 21:25  瑶啊摇✨  阅读(194)  评论(0编辑  收藏  举报