centos8安装MySQL8及设置远程访问

2021/5/30 19:20:27

本文主要是介绍centos8安装MySQL8及设置远程访问,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

[mysql@localhost ~]$ wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
--2021-05-30 15:54:22--  https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
正在解析主机 dev.mysql.com (dev.mysql.com)... 137.254.60.11
正在连接 dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:https://repo.mysql.com//mysql80-community-release-el8-1.noarch.rpm [跟随至新的 URL]
--2021-05-30 15:54:23--  https://repo.mysql.com//mysql80-community-release-el8-1.noarch.rpm
正在解析主机 repo.mysql.com (repo.mysql.com)... 96.17.188.242
正在连接 repo.mysql.com (repo.mysql.com)|96.17.188.242|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:30388 (30K) [application/x-redhat-package-manager]
正在保存至: “mysql80-community-release-el8-1.noarch.rpm”

mysql80-community-release-el8-1.n 100%[==========================================================>]  29.68K   166KB/s  用时 0.2s    

2021-05-30 15:54:24 (166 KB/s) - 已保存 “mysql80-community-release-el8-1.noarch.rpm” [30388/30388])

[mysql@localhost ~]$ rpm -ivh mysql80-community-release-el8-1.noarch.rpm
警告:mysql80-community-release-el8-1.noarch.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
错误:无法创建 事务 锁定于 /var/lib/rpm/.rpm.lock (权限不够) 

[mysql@localhost ~]$ ls
mysql80-community-release-el8-1.noarch.rpm
[mysql@localhost ~]$ pwd
/data/
[mysql@localhost ~]$ su - root
密码:
[root@localhost ~]# cd /data/
[root@localhost data]# 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%]
	file /etc/yum.repos.d/mysql-community-source.repo from install of mysql80-community-release-el8-1.noarch conflicts with file from package mysql80-community-release-el7-3.noarch
	file /etc/yum.repos.d/mysql-community.repo from install of mysql80-community-release-el8-1.noarch conflicts with file from package mysql80-community-release-el7-3.noarch

[root@localhost data]# md5sum mysql80-community-release-el8-1.noarch.rpm
7166fed89332ab92fb3ec666e95d6ad1  mysql80-community-release-el8-1.noarch.rpm
[root@localhost data]# vim /etc/sudoers
[root@localhost data]# 
[root@localhost data]# 
[root@localhost data]# chmod 440 /etc/sudoers
[root@localhost data]# 

正在解析主机 dev.mysql.com (dev.mysql.com)... 137.254.60.11
正在连接 dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
[root@localhost data]# md5sum mysql80-community-release-el8-1.noarch.rpm
=====================================================================================================================================
安装依赖关系:
 mariadb-connector-c-config            noarch            3.1.11-2.el8_3                                   appstream             15 k
the root password from the network.
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
| localhost | root             | mysql_native_password |
+-----------+------------------+-----------------------+
4 rows in set (0.00 sec)

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远程链接效果如下:↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓



这篇关于centos8安装MySQL8及设置远程访问的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程