[root@VM-16-2-centos ~]# yum info mysql-server.x86_64
Last metadata expiration check: 1:50:01 ago on Wed 25 Aug 2021 11:30:34 AM CST.
Installed Packages
Name : mysql-server
Version : 8.0.21
Release : 1.module_el8.2.0+493+63b41e36
Architecture : x86_64
Size : 108 M
Source : mysql-8.0.21-1.module_el8.2.0+493+63b41e36.src.rpm
Repository : @System
From repo : appstream
Summary : The MySQL server and related files
URL : http://www.mysql.com
License : GPLv2 with exceptions and LGPLv2 and BSD
Description : MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
: client/server implementation consisting of a server daemon (mysqld)
: and many different client programs and libraries. This package contains
: the MySQL server and some accompanying files and directories.
# 登录,无密码,直接回车
$ mysql -uroot -p
# 修改密码> ALTER user 'root'@'localhost' IDENTIFIED BY 'root123456'
创建账号允许远程登录
# 允许所有ip连接> create user 'work'@'%' identified by 'work123456';> grant all on *.* to work@'%';> flush privileges;# 设置mysql允许远程连接
$ vim /etc/my.cnf.d/mysql-server.cnf
# 添加下面这一行允许远端ip连接服务器
bind-address =0.0.0.0
# 重启mysql服务
systemctl restart mysqld