离线安装 mysql 8.0.19 rpm

文章目录

  • 安装
  • 使用
  • 安全
  • 其他

见 https://centos.pkgs.org/7/mysql-8.0-x86_64/mysql-community-server-8.0.19-1.el7.x86_64.rpm.html

各种版本理论上都可以这样安装~

安装

下载地址

https://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-server-8.0.19-1.el7.x86_64.rpm

一些依赖

https://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-common-8.0.19-1.el7.x86_64.rpm

https://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-libs-8.0.19-1.el7.x86_64.rpm

https://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-client-8.0.19-1.el7.x86_64.rpm

移除 mariadb 相关依赖

yum list installed | grep maria
yum remove mariadb-libs.x86_64
yum install mysql-community-common-8.0.19-1.el7.x86_64.rpm
yum install mysql-community-libs-8.0.19-1.el7.x86_64.rpm
yum install mysql-community-client-8.0.19-1.el7.x86_64.rpm
yum install mysql-community-server-8.0.19-1.el7.x86_64.rpm

可能会缺失的一些依赖

[root@centos7_vm ~]# yum list installed | grep net-tools
net-tools.x86_64 2.0-0.25.20131004git.el7 @base
[root@centos7_vm ~]# yum list installed | grep libaio
libaio.x86_64 0.3.109-13.el7 @anaconda

http://mirror.centos.org/centos/7/os/x86_64/Packages/net-tools-2.0-0.25.20131004git.el7.x86_64.rpm

http://mirror.centos.org/centos/7/os/x86_64/Packages/libaio-0.3.109-13.el7.x86_64.rpm

其他的话也可以到 https://centos.pkgs.org/7/mysql-8.0-x86_64/mysql-community-server-8.0.19-1.el7.x86_64.rpm.html 查看相关依赖

使用

开启 mysqld 服务即可

systemctl start mysqld

初始密码在日志中

grep "A temporary password" /var/log/mysqld.log

示例输出

[root@centos7_vm ~]# grep "A temporary password" /var/log/mysqld.log
2020-04-14T03:02:22.204287Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: f

安全

首次安装MySQL之后,执行 mysql_secure_installation 命令以保护MySQL服务器。它会提示您几个问题,我们建议每个问题都回答(y)。

示例

Enter password for user root:

The existing password for the user account root has expired. Please set a new password.

New password:
Re-enter new password:

Change the password for root ? ((Press y|Y for Yes, any other key for No) : n

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

其他

用上面修改后的密码登录即可

mysql -uroot -p

修改密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';

安全问题不能将密码设置得太简单了

Your password does not satisfy the current policy requirements
SHOW VARIABLES LIKE 'validate_password%';

+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password.check_user_name    | ON     |
| validate_password.dictionary_file    |        |
| validate_password.length             | 8      |
| validate_password.mixed_case_count   | 1      |
| validate_password.number_count       | 1      |
| validate_password.policy             | MEDIUM |
| validate_password.special_char_count | 1      |
+--------------------------------------+--------+
SET GLOBAL validate_password.length = 4;
SET GLOBAL validate_password.number_count = 0;
SET GLOBAL validate_password.special_char_count = 0;
SET GLOBAL validate_password.mixed_case_count = 0;
SET GLOBAL validate_password.policy = LOW;
SET GLOBAL validate_password.check_user_name = OFF;
flush privileges;

改完后就可以用 root 这种简单的密码了,不过不安全

你可能感兴趣的:(mysql,mysql,centos,linux,yum)