centos8 rpm 安装mysql8.0.28

检查

检测系统是否自带安装 MySQL

命令如下:
rpm -qa | grep mysql
如果如下存在已安装的包,就需要卸载
mysql80-community-release-el8-1.noarch
mysql-community-client-8.0.18-1.el8.x86_64
mysql-community-libs-8.0.18-1.el8.x86_64
mysql-community-server-8.0.18-1.el8.x86_64
mysql-community-common-8.0.18-1.el8.x86_64

卸载命令

存在mysql已安装的包就需要依次卸载

rpm -e mysql  // 普通删除
rpm -e --nodeps mysql  // 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删

查看是否安装了mariadb;

rpm -qa | grep mariadb

如果有安装的话使用如下命令移除:

rpm -e XXX

rpm -e --nodeps xxx //强制删除

下载

官网地址

MySQL :: Download MySQL Community Server

下载 centos8 的

mysql-8.0.28-1.el8.x86_64.rpm-bundle.tar

使用浏览器自带下载功能下载有时候可能会出现因为网络等原因包下载不完整而出问题的情况(最好下载后校验哈希值),如若正常安装老是出问题,推荐使用迅雷等下载工具下载后校验完毕,使用FTP近程传输到服务器安装目录。

解压

[root@localhost rootftp]# ls
mysql-8.0.28-1.el8.x86_64.rpm-bundle.tar
mysql-community-client-8.0.28-1.el8.x86_64.rpm
mysql-community-client-debuginfo-8.0.28-1.el8.x86_64.rpm
mysql-community-client-plugins-8.0.28-1.el8.x86_64.rpm
mysql-community-client-plugins-debuginfo-8.0.28-1.el8.x86_64.rpm
mysql-community-common-8.0.28-1.el8.x86_64.rpm
mysql-community-debuginfo-8.0.28-1.el8.x86_64.rpm
mysql-community-debugsource-8.0.28-1.el8.x86_64.rpm
mysql-community-devel-8.0.28-1.el8.x86_64.rpm
mysql-community-icu-data-files-8.0.28-1.el8.x86_64.rpm
mysql-community-libs-8.0.28-1.el8.x86_64.rpm
mysql-community-libs-debuginfo-8.0.28-1.el8.x86_64.rpm
mysql-community-server-8.0.28-1.el8.x86_64.rpm
mysql-community-server-debug-8.0.28-1.el8.x86_64.rpm
mysql-community-server-debug-debuginfo-8.0.28-1.el8.x86_64.rpm
mysql-community-server-debuginfo-8.0.28-1.el8.x86_64.rpm
mysql-community-test-8.0.28-1.el8.x86_64.rpm
mysql-community-test-debuginfo-8.0.28-1.el8.x86_64.rpm
[root@localhost rootftp]#

安装

注意安装顺序

  • mysql-community-common
  • 三个一起装 因为 有依赖
    • mysql-community-libs-***.rpm
    • mysql-community-client-***.rpm
    • mysql-community-client-plugins-***.rpm
  • mysql-community-server-***.rpm
    • 因为依赖perl ,所以可以直接通过yum方式安装
    • yum install mysql-community-server-****.x86_64.rpm

本人采用的安装顺序,含最末回车符号批量复制进去可以实现一次性批处理安装至结束,直接接续配置步骤:

rpm -ivh mysql-community-common-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-libs-debuginfo-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-plugins-debuginfo-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-debuginfo-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-debuginfo-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-debugsource-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-devel-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-server-debug-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-server-debug-debuginfo-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-server-debuginfo-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-test-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-test-debuginfo-8.0.28-1.el8.x86_64.rpm
rpm -ivh mysql-community-server-8.0.28-1.el8.x86_64.rpm

On the CentOS 9 Stream,  It may thread out Erorr message,like:

warning: mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
libcrypto.so.10()(64bit) is needed by mysql-community-libs-compat-5.7.28-1.el7.x86_64
libcrypto.so.10(libcrypto.so.10)(64bit) is needed by mysql-community-libs-compat-5.7.28-1.el7.x86_64
libssl.so.10()(64bit) is needed by mysql-community-libs-compat-5.7.28-1.el7.x86_64
libssl.so.10(libssl.so.10)(64bit) is needed by mysql-community-libs-compat-5.7.28-1.el7.x86_64 Just Like this , not exactly the same.

To deal with the error, you can try to add --nodeps --force after the "rpm -ivh ***" commond.

rpm -ivh mysql-community-common-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-libs-debuginfo-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-client-plugins-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-client-plugins-debuginfo-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-libs-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-client-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-debuginfo-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-client-debuginfo-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-debugsource-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-devel-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-icu-data-files-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-server-debug-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-server-debug-debuginfo-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-server-debuginfo-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-test-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-test-debuginfo-8.0.28-1.el8.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-server-8.0.28-1.el8.x86_64.rpm --nodeps --force
[root@localhost rootftp]# rpm -ivh mysql-community-common-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-common-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-common-8.0.28-1.e################################# [100%]
[root@localhost rootftp]# rpm -ivh mysql-community-libs-debuginfo-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-libs-debuginfo-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
error: Failed dependencies:
mysql-community-debuginfo(x86-64) = 8.0.28-1.el8 is needed by mysql-community-libs-debuginfo-8.0.28-1.el8.x86_64
[root@localhost rootftp]# rpm -ivh mysql-community-client-plugins-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-client-plugins-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-client-plugins-8.################################# [100%]
[root@localhost rootftp]# rpm -ivh mysql-community-client-plugins-debuginfo-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-client-plugins-debuginfo-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
error: Failed dependencies:
mysql-community-debuginfo(x86-64) = 8.0.28-1.el8 is needed by mysql-community-client-plugins-debuginfo-8.0.28-1.el8.x86_64
[root@localhost rootftp]# rpm -ivh mysql-community-libs-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-libs-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-8.0.28-1.el8################################# [100%]
[root@localhost rootftp]# rpm -ivh mysql-community-client-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-client-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-client-8.0.28-1.e################################# [100%]
[root@localhost rootftp]# rpm -ivh mysql-community-debuginfo-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-debuginfo-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-debuginfo-8.0.28-################################# [100%]
[root@localhost rootftp]# rpm -ivh mysql-community-client-debuginfo-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-client-debuginfo-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-client-debuginfo-################################# [100%]
[root@localhost rootftp]# rpm -ivh mysql-community-debugsource-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-debugsource-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-debugsource-8.0.2################################# [100%]
[root@localhost rootftp]# rpm -ivh mysql-community-devel-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-devel-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-devel-8.0.28-1.el################################# [100%]
[root@localhost rootftp]# rpm -ivh mysql-community-icu-data-files-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-icu-data-files-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-icu-data-files-8.################################# [100%]
[root@localhost rootftp]# rpm -ivh mysql-community-server-debug-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-server-debug-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
error: Failed dependencies:
mysql-community-server = 8.0.28-1.el8 is needed by mysql-community-server-debug-8.0.28-1.el8.x86_64
[root@localhost rootftp]# rpm -ivh mysql-community-server-debug-debuginfo-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-server-debug-debuginfo-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-server-debug-debu################################# [100%]
[root@localhost rootftp]# rpm -ivh mysql-community-server-debuginfo-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-server-debuginfo-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-server-debuginfo-################################# [100%]
[root@localhost rootftp]# rpm -ivh mysql-community-test-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-test-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
error: Failed dependencies:
mysql-community-server(x86-64) >= 8.0.11 is needed by mysql-community-test-8.0.28-1.el8.x86_64
perl(JSON) is needed by mysql-community-test-8.0.28-1.el8.x86_64
[root@localhost rootftp]# rpm -ivh mysql-community-test-debuginfo-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-test-debuginfo-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-test-debuginfo-8.################################# [100%]
[root@localhost rootftp]# rpm -ivh mysql-community-server-8.0.28-1.el8.x86_64.rpm
warning: mysql-community-server-8.0.28-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-server-8.0.28-1.e################################# [100%]
[/usr/lib/tmpfiles.d/pesign.conf:1] Line references path below legacy directory /var/run/, updating /var/run/pesign → /run/pesign; please update the tmpfiles.d/ drop-in file accordingly.
[root@localhost rootftp]# yum install mysql-server
Last metadata expiration check: 1:37:35 ago on Thu 03 Mar 2022 03:07:09 AM EST.
Package mysql-community-server-8.0.28-1.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@localhost rootftp]# yum install mysql
Last metadata expiration check: 1:37:50 ago on Thu 03 Mar 2022 03:07:09 AM EST.
Package mysql-community-client-8.0.28-1.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

安装完成

  • 安装完成后,会自动生成 /etc/my.cnf 配置文件

  • 安装了 mysql-community-server 组件,会:
    a). 在 /etc/下生成 my.cnf 文件 和 my.cnf.d 文件夹

    b). 在/var/lib/下生产以下三个文件夹

    c). 在/var/log/ 下生成 mysqld.log 文件

    d). 在/var/run/ 下生成 mysqld 目录

[root@localhost rootftp]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html [mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

启动mysql

[root@localhost rootftp]# systemctl start mysqld
[root@localhost rootftp]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor pres>
Active: active (running) since Thu 2022-03-03 04:46:34 EST; 20s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 41027 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=>
Main PID: 41061 (mysqld)
Status: "Server is operational"
Tasks: 38 (limit: 23385)
Memory: 471.0M
CGroup: /system.slice/mysqld.service
└─41061 /usr/sbin/mysqld Mar 03 04:46:27 localhost.localdomain systemd[1]: Starting MySQL Server...
Mar 03 04:46:34 localhost.localdomain systemd[1]: Started MySQL Server.

修改密码

  • 查看密码
[root@localhost rootftp]# grep 'temporary password' /var/log/mysqld.log
2022-03-03T07:10:39.887374Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: U<=VsitGY83w
[root@localhost rootftp]# mysql

修改密码

[root@localhost rootftp]# mysql

mysql> alter user 'root'@'localhost' identified by 'root';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> set global validate_password_length=1;
ERROR 1193 (HY000): Unknown system variable 'validate_password_length'
mysql> show global
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
mysql> SHOW VARIABLES LIKE 'validate_password%';
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER 'root'@'localhost' identified by '12345678Aa?';
Query OK, 0 rows affected (0.00 sec) mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec) mysql> 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 |
+--------------------------------------+--------+
7 rows in set (0.01 sec) mysql> set global validate_password.length=4;
Query OK, 0 rows affected (0.00 sec) mysql> set global validate_password.policy=0;
Query OK, 0 rows affected (0.00 sec) mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+-------+
| Variable_name | Value |
+--------------------------------------+-------+
| validate_password.check_user_name | ON |
| validate_password.dictionary_file | |
| validate_password.length | 4 |
| validate_password.mixed_case_count | 1 |
| validate_password.number_count | 1 |
| validate_password.policy | LOW |
| validate_password.special_char_count | 1 |
+--------------------------------------+-------+
7 rows in set (0.00 sec) mysql> ALTER USER 'root'@'localhost' identified by '新密码';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> ALTER USER 'root'@'localhost' identified by '新密码';
Query OK, 0 rows affected (0.00 sec) mysql> ALTER USER 'root'@'localhost' identified by '新密码';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> exit
Bye
[root@192 home]# mysql -u root -p1234
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.23 MySQL Community Server - GPL 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> exit
Bye
[root@192 home]#
  • 问题 短密码不能设置,需要修改密码策略

    • set global validate_password.length=4; 密码长度改成4
    • set global validate_password.policy=0; 密码校验强度改成LOW后,只校验密码长度

查看当前安全变量值并修改

mysql> 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 |
+--------------------------------------+--------+
7 rows in set (0.01 sec) mysql> set global validate_password.length=4;
Query OK, 0 rows affected (0.00 sec) mysql> set global validate_password.policy=0;
Query OK, 0 rows affected (0.00 sec) mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+-------+
| Variable_name | Value |
+--------------------------------------+-------+
| validate_password.check_user_name | ON |
| validate_password.dictionary_file | |
| validate_password.length | 4 |
| validate_password.mixed_case_count | 1 |
| validate_password.number_count | 1 |
| validate_password.policy | LOW |
| validate_password.special_char_count | 1 |
+--------------------------------------+-------+
7 rows in set (0.00 sec)

设置开机启动

[root@192 home]# systemctl enable mysqld

CentOS 9 Stream rpm 安装mysql8.0.29

    # !!!注意:以下参考除命令以外很多是说明文字,不要全部复制,自行选择该执行的命令
方法一(推荐):使用yum安装基础依赖并通过yum安装mysql-community-{server,client,common,libs}-*(亲测能解决所需依赖,正常安装)
# 如果系统提示类似“compat-openssl10 is needed”或者各种提示缺乏依赖的情况,可改用yum进行安装
yum install compat-openssl10
yum install http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/compat-openssl10-1.0.2o-3.el8.x86_64.rpm sudo yum update
sudo yum install mysql-community-{server,client,common,libs}-*
mysql # 方法二:官网下载mysql-8.0.29-1.el8.x86_64.rpm-bundle.tar 包解压安装,此种方法要注意解决提示的依赖项和rpm包的安装顺序。
[root@dz Downloads]#wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.29-1.el8.x86_64.rpm-bundle.tar
chmod 777 mysql-8.0.29-1.el8.x86_64.rpm-bundle.tar
tar -xvf mysql-8.0.29-1.el8.x86_64.rpm-bundle.tar #解压后会得到很多个mysql组件的rpm包
ls
# 检查系统中已经存在的mysql和mariadb并卸载干净
rpm -qa | grep mysql
rpm -e mysql80-community-release-el8-4.noarch
rpm -qa | grep mariadb
rpm -e
rpm -e mariadb-connector-c-config-3.2.6-1.el9.noarch
rpm -e
rpm -e mariadb-connector-c-3.2.6-1.el9.x86_64
rpm -e mariadb-connector-c-3.2.6-1.el9.x86_64 --nodeps
rpm -e mariadb-connector-c-config-3.2.6-1.el9.noarch --nodeps
rpm -ivh mysql-community-common-8.0.29-1.el8.x86_64.rpm
# 正式开始安装,此参考安装顺序有时候会提示缺乏依赖项,逐一解决后全部安装完才可以,比较麻烦
rpm -ivh mysql-community-libs-debuginfo-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-plugins-debuginfo-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-debuginfo-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-debuginfo-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-debugsource-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-devel-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-server-debug-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-server-debug-debuginfo-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-server-debuginfo-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-test-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-test-debuginfo-8.0.29-1.el8.x86_64.rpm
rpm -ivh mysql-community-server-8.0.29-1.el8.x86_64.rpm # 安装完成后进行配置和修改管理密码 [root@dz]#cat /etc/my.cnf
clear
vi /etc/my.cnf cat /etc/my.cnf systemctl start mysqld ystemctl status mysqld stemctl status mysqld systemctl status mysqld grep 'temporary password' /var/log/mysqld.log
# 执行成功回显信息附带了临时密码,显示如下:
[root@dz Downloads]# grep 'temporary password' /var/log/mysqld.log
2022-07-05T07:15:05.672937Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: dz8>DAfTfwtM
# 其中,最末尾的字符串“dz8>DAfTfwtM”即为安装生成的临时密码,供修改密码使用 mysql systemctl status mysqld
# 此命令执行后应该返回如下:active(running)状态为绿色
[root@dz Downloads]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2022-07-05 03:51:22 EDT; 15s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 23785 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 23812 (mysqld)
Status: "Server is operational"
Tasks: 37 (limit: 43552)
Memory: 391.3M
CPU: 2.104s
CGroup: /system.slice/mysqld.service
└─23812 /usr/sbin/mysqld Jul 05 03:51:18 dz systemd[1]: Starting MySQL Server...
Jul 05 03:51:22 dz systemd[1]: Started MySQL Server. #输入mysql唤醒mysql程序
mysql
mysql> # 输入mysql进入“mysql>”提示符表示安装成功,并已经唤醒进入到mysql,首次应该执行下一条命令来修改root管理密码, ALTER USER 'root'@'localhost' identified by '你的新密码';
Enter password: #这里要求的密码要输入上面查出来的临时密码 mysql
# 如果出现 类似“
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
”或“ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
”的情况,可以回退到命令行超级权限,先修改my.cnf,在[mysqld]下面一行添加:
skip-grant-tables
# ESC保存":wq",然后修改密码
mysql -u root -p
mysql
ALTER USER 'root'@'localhost' identified by '你的新密码'; # 出现以下提示说明密码已经修改成功,多登入几次试试能成功进入mysql>并执行相关数据库操作命令,以避免自己埋坑
[root@dz Downloads]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 22
Server version: 8.0.29 MySQL Community Server - GPL Copyright (c) 2000, 2022, 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. # ====================================== [root@dz Downloads]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.29 MySQL Community Server - GPL Copyright (c) 2000, 2022, 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. # 安装完并已经修改完mysql密码以后,最好是把mysqld服务重启一下,以下为centOS9 Stream操作命令,centOS8类似,其他版本系统自己查命令
systemctl stop mysqld
systemctl start mysqld
systemctl status mysqld
mysql
mysql>

centos8 \CentOS 9 Stream rpm 安装mysql8.0.28的更多相关文章

  1. Linux(CentOS7)下rpm安装MySQL8.0.16

    记录一下自己在 CentOS7 下 rpm 安装 MySQL8.0.16 的过程. 一.准备工作 1. 下载MySQL所需要的安装包 从 MySQL官网 下载,上传至 CentOS 系统 /usr/l ...

  2. Linux下以tar包的形式安装mysql8.0.28

    Linux下以tar包的形式安装mysql8.0.28 1.首先卸载自带的Mysql-libs(如果之前安装过mysql,要全都卸载掉) rpm -qa | grep -i -E mysql\|mar ...

  3. centos 安装mysql8.0.16

    清除自带的mariadb > rpm -qa|grep mariadb mariadb-libs-5.5.44-2.el7.centos.x86_64 > rpm -e --nodeps ...

  4. CentOS8.1操作系下使用通用二进制包安装MySQL8.0(实践整理自MySQL官方)

    写在前的的话: 在IT技术日新月异的今天,老司机也可能在看似熟悉的道路上翻车,甚至是大型翻车现场!自己一个人开车过去翻个车不可怕,可怕的是带着整个团队甚至是整个公司一起翻车山崖下,解决办法就是:新出现 ...

  5. centos 7下安装mysql-8.0

    本篇文章主要介绍在centos7 环境下安装mysql8.0并设置为开机自启. 安装步骤 1.配置yum源 首先在 https://dev.mysql.com/downloads/repo/yum/  ...

  6. 【Linux系列】Centos 7安装 Mysql8.0(五)

    目的 本文主要介绍以下两点: 一. 如何安装Mysql8.0 二. Navicat连接Mysql 一. 如何安装Mysql8.0 安装Mysql有两种方式: 直接下载官方的源(比较慢) https:/ ...

  7. CentOS8 安装MySQL8.0

    2019/11/25, CentOS 8,MySQL 8.0 摘要: CentOS 8 安装MySQL 8.0 并配置远程登录 安装MySQL8.0 使用最新的包管理器安装MySQL sudo dnf ...

  8. Linux(CentOS-8)安装MySQL8.0.11

    CentOS安装MySQL8.0.11 总的思路就是:安装MySQL,编写配置文件,配置环境变量,成功开启服务,登陆并修改ROOT密码 开启远程访问的思路就是:授权用户所有IP都可以访问,系统的数据库 ...

  9. CentOS7安装MySQL8.0小计

    之前讲配置文件和权限的时候有很多MySQL8的知识,有同志说安装不太一样,希望发个文,我这边简单演示一下 1.环境安装 下载MySQL提供的CentOS7的yum源 官方文档:<https:// ...

  10. CentOS7.5 上使用 bundle 文件安装 MySQL8.0 MySQL5.0

    CentOS7.5 上使用 bundle 文件安装 MySQL8.0 MySQL5.0 CentOS7.5 环境 [root@instance-fjii60o3 ~]# rpm -qi centos- ...

随机推荐

  1. 机器学习策略篇:详解训练/开发/测试集划分(Train/dev/test distributions)

    训练/开发/测试集划分 设立训练集,开发集和测试集的方式大大影响了或者团队在建立机器学习应用方面取得进展的速度.同样的团队,即使是大公司里的团队,在设立这些数据集的方式,真的会让团队的进展变慢而不是加 ...

  2. STM32F103xC,xD,xE引脚定义

    STM32F103xC,xD,xE引脚定义 由于在使用STM32系列芯片过程中发现互联网没有整理好的引脚定义,因此自己整理一份,方便以后查阅. GPIOA Pin 重新上电时的功能 默认功能 重映射 ...

  3. C#条码识别的解决方案(ZBar)

    简介 主流的识别库主要有ZXing.NET和ZBar,OpenCV 4.0后加入了QR码检测和解码功能.本文使用的是ZBar,同等条件下ZBar识别率更高,图片和部分代码参考在C#中使用ZBar识别条 ...

  4. [转] vscode C/C++ 插件预定义环境变量(linux)

    原文 假设: 你当前编辑的文件是: /home/your-username/your-project/folder/file.ext /home/your-username/your-project ...

  5. Retrofit源码分析

    目录介绍 1.首先回顾Retrofit简单使用方法 2.Retrofit的创建流程源码分析 2.1 Retrofit对象调用Builder()源码解析 2.2 Retrofit对象调用baseUrl( ...

  6. 【福利】JetBrains 全家桶永久免费使用

    Jetbrains系列的IDE公认是最好的集成开发工具,但是收费且挺贵.我们以PhpStorm为例,新用户第一年需要199$,注意是$,还不是人民币,这个价格一上来肯定筛选掉一大批用户.确实好用,所以 ...

  7. 重返ubuntu世界

    一直对"重返"两个字充满了情怀感,因为会想起小时候看的一本龙珠同人的标题,它就唤作<重回龙珠世界>.最近这五年基本都是在MacOS下工作和学习的,也习惯用MacOS.就 ...

  8. 马文·柯林斯的教育之道 「Marva Collins' Way」 阅读笔记

    <马文·柯林斯的教育之道> 是 哈佛幸福课(积极心理学) 中强列推荐的一本书 这本书主写的是 马文·柯林斯 的成长经历已经和教育理念,仅看介绍,会误认为这本书只是在说鼓励式的教学理念,看完 ...

  9. ChatGPT 指令大全

    1.写报告 报告开头 我现在正在 报告的情境与目的 .我的简报主题是 主题 ,请提供 数字 种开头方式,要简单到 目标族群 能听懂,同时要足够能吸引人,让他们愿意专心听下去. 我现在正在修台大的简报课 ...

  10. 2022福州大学MEM复试英语口语准备

    一.自我介绍 Dear professors, it's my honor to be here for my interview. My name is ,I finished my undergr ...