centos8安装MySQL8及设置远程访问

这篇博客详细记录了在 CentOS 上通过 wget 下载 MySQL 8.0 安装包,使用 rpm 安装,验证 RPM 与 MD5,然后启用并修改 root 用户权限的过程。重点包括解决 RPM 签名问题、检查服务状态及权限设置。
摘要由CSDN通过智能技术生成
[root@VM-16-15-centos server]# wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
--2021-12-10 15:13:14--  https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
正在解析主机 dev.mysql.com (dev.mysql.com)... 137.254.60.11
    

2021-12-10 15:13:16 (201 MB/s) - 已保存 “mysql80-community-release-el8-1.noarch.rpm” [30388/30388])

[root@VM-16-15-centos server]# rpm -ivh mysql80-community-release-el8-1.noarch.rpm
警告:mysql80-community-release-el8-1.noarch.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
Verifying...                          ################################# [100%]
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql80-community-release-el8-1  ################################# [100%]
[root@VM-16-15-centos server]# md5sum mysql80-community-release-el8-1.noarch.rpm
7166fed89332ab92fb3ec666e95d6ad1  mysql80-community-release-el8-1.noarch.rpm
[root@VM-16-15-centos server]# yum install mysql-server
MySQL 8.0 Community Server                                                                      713 kB/s | 2.1 MB     00:03    
                           

完毕!
[root@VM-16-15-centos server]# systemctl list-unit-files|grep mysqld
mysqld.service                              disabled       
mysqld@.service                             disabled       
[root@VM-16-15-centos server]# systemctl enable mysqld.service
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.
[root@VM-16-15-centos server]# systemctl list-unit-files|grep mysqld
mysqld.service                              enabled        
mysqld@.service                             disabled       
[root@VM-16-15-centos server]# ps -ef|grep mysql
root      154955    1947  0 15:23 pts/0    00:00:00 grep --color=auto mysql
[root@VM-16-15-centos server]# systemctl start mysqld.service
[root@VM-16-15-centos server]# 

[root@VM-16-15-centos server]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.26 Source distribution

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> 
mysql> update user set host='%' where user ='root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select host,user,plugin from user;
+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| %         | root             | mysql_native_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
+-----------+------------------+-----------------------+
4 rows in set (0.01 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root1234';
Query OK, 0 rows affected (0.00 sec)

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql>

sqlyog远程链接效果如下:↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值