CentOs7 yum安装mysql8.0

    科技2022-07-10  129

    yum存储库安装MySQL 配置yum仓库

    [root@localhost ~]# wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm [root@localhost ~]# yum localinstall mysql80-community-release-el7-1.noarch.rpm [root@localhost ~]# yum repolist enabled|grep "mysql.*-community.*" mysql-connectors-community/x86_64 MySQL Connectors Community 165 mysql-tools-community/x86_64 MySQL Tools Community 115 mysql80-community/x86_64 MySQL 8.0 Community Server 193 [root@localhost ~]# yum repolist all|grep mysql mysql-cluster-7.5-community/x86_64 MySQL Cluster 7.5 Community 禁用 mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community - So 禁用 mysql-cluster-7.6-community/x86_64 MySQL Cluster 7.6 Community 禁用 mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community - So 禁用 mysql-connectors-community/x86_64 MySQL Connectors Community 启用: 165 mysql-connectors-community-source MySQL Connectors Community - Sou 禁用 mysql-tools-community/x86_64 MySQL Tools Community 启用: 115 mysql-tools-community-source MySQL Tools Community - Source 禁用 mysql-tools-preview/x86_64 MySQL Tools Preview 禁用 mysql-tools-preview-source MySQL Tools Preview - Source 禁用 mysql55-community/x86_64 MySQL 5.5 Community Server 禁用 mysql55-community-source MySQL 5.5 Community Server - Sou 禁用 mysql56-community/x86_64 MySQL 5.6 Community Server 禁用 mysql56-community-source MySQL 5.6 Community Server - Sou 禁用 mysql57-community/x86_64 MySQL 5.7 Community Server 禁用 mysql57-community-source MySQL 5.7 Community Server - Sou 禁用 mysql80-community/x86_64 MySQL 8.0 Community Server 启用: 193 mysql80-community-source MySQL 8.0 Community Server - Sou 禁用

    安装

    [root@localhost ~]# yum install mysql-community-server [root@localhost ~]# systemctl enable mysqld [root@localhost ~]# systemctl start mysqld [root@localhost ~]# netstat -lntup|grep 3306

    查看随机生成的密码

    [root@localhost ~]# grep 'temporary password' /var/log/mysqld.log

    登录

    [root@localhost ~]#mysql -uroot -p

    修改密码

    mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY'Admin123!@#';

    密码不能太过简单否则修改失败 完成

    Processed: 0.022, SQL: 8