centos8 \CentOS 9 Stream rpm 安装mysql8.0.28
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.rpmOn 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的更多相关文章
- Linux(CentOS7)下rpm安装MySQL8.0.16
记录一下自己在 CentOS7 下 rpm 安装 MySQL8.0.16 的过程. 一.准备工作 1. 下载MySQL所需要的安装包 从 MySQL官网 下载,上传至 CentOS 系统 /usr/l ...
- Linux下以tar包的形式安装mysql8.0.28
Linux下以tar包的形式安装mysql8.0.28 1.首先卸载自带的Mysql-libs(如果之前安装过mysql,要全都卸载掉) rpm -qa | grep -i -E mysql\|mar ...
- centos 安装mysql8.0.16
清除自带的mariadb > rpm -qa|grep mariadb mariadb-libs-5.5.44-2.el7.centos.x86_64 > rpm -e --nodeps ...
- CentOS8.1操作系下使用通用二进制包安装MySQL8.0(实践整理自MySQL官方)
写在前的的话: 在IT技术日新月异的今天,老司机也可能在看似熟悉的道路上翻车,甚至是大型翻车现场!自己一个人开车过去翻个车不可怕,可怕的是带着整个团队甚至是整个公司一起翻车山崖下,解决办法就是:新出现 ...
- centos 7下安装mysql-8.0
本篇文章主要介绍在centos7 环境下安装mysql8.0并设置为开机自启. 安装步骤 1.配置yum源 首先在 https://dev.mysql.com/downloads/repo/yum/ ...
- 【Linux系列】Centos 7安装 Mysql8.0(五)
目的 本文主要介绍以下两点: 一. 如何安装Mysql8.0 二. Navicat连接Mysql 一. 如何安装Mysql8.0 安装Mysql有两种方式: 直接下载官方的源(比较慢) https:/ ...
- CentOS8 安装MySQL8.0
2019/11/25, CentOS 8,MySQL 8.0 摘要: CentOS 8 安装MySQL 8.0 并配置远程登录 安装MySQL8.0 使用最新的包管理器安装MySQL sudo dnf ...
- Linux(CentOS-8)安装MySQL8.0.11
CentOS安装MySQL8.0.11 总的思路就是:安装MySQL,编写配置文件,配置环境变量,成功开启服务,登陆并修改ROOT密码 开启远程访问的思路就是:授权用户所有IP都可以访问,系统的数据库 ...
- CentOS7安装MySQL8.0小计
之前讲配置文件和权限的时候有很多MySQL8的知识,有同志说安装不太一样,希望发个文,我这边简单演示一下 1.环境安装 下载MySQL提供的CentOS7的yum源 官方文档:<https:// ...
- CentOS7.5 上使用 bundle 文件安装 MySQL8.0 MySQL5.0
CentOS7.5 上使用 bundle 文件安装 MySQL8.0 MySQL5.0 CentOS7.5 环境 [root@instance-fjii60o3 ~]# rpm -qi centos- ...
随机推荐
- SQL之 数据库表字段约束与索引
第三范式 MySQL四种字段约束 主键约束 非空约束 唯一约束 创建索引 添加和删除索引
- 使用Servlet进行页面跳转的两种方式
最近在教学生学习JavaWeb相关的技术,刚好讲到Java当中的Servlet,一个服务端的小程序. 也在和学生讲使用Servlet如何进行页面跳转,一种方式是使用请求转发进行页面跳转,一种方式 是使 ...
- WPF之认识XAML
目录 新建项目 剖析XAML代码 参考资料 新建项目 在Visual Studio 2019中使用WPF项目模板建立一个最简单的WPF项目,如下图所示: 可以看到,项目里面主要有两个分支: App.x ...
- CRC常用参数模型及C#代码实现
目录 参数模型 算法实现 CRC-32 CRC-32/MPEG-2 表生成算法 参考资料 本文源码 参数模型 CRC即循环冗余校验码(Cyclic Redundancy Check):是数据通信领域中 ...
- 解决 Steam for Linux 部分 Valve 游戏中文显示问题/军团要塞2的字体显示问题
解决 Steam for Linux 部分 Valve 游戏中文显示问题 发表于 Apr 7th 2019 | 分类于 Keep Digging Steam for Linux 上有许多好玩的免费游戏 ...
- In-batch negatives Embedding模型介绍与实践
语义索引(可通俗理解为向量索引)技术是搜索引擎.推荐系统.广告系统在召回阶段的核心技术之一.语义索引模型的目标是:给定输入文本,模型可以从海量候选召回库中快速.准确地召回一批语义相关文本.语义索引模型 ...
- c基础-指针、函数与预处理器
指针.函数.预处理器 目录 指针.函数.预处理器 1.指针 解引用 指针运算 数组和指针 const char *, char const *, char * const,char const * c ...
- LeNet-5 论文及原理分析(笨鸟角度)
PS:要转载请注明出处,本人版权所有. PS: 这个只是基于<我自己>的理解, 如果和你的原则及想法相冲突,请谅解,勿喷. 前置说明 本文作为本人csdn blog的主站的备份.(Bl ...
- uni组件传值注意
目录介绍 01.组件传值遇到坑 02.父组件传值给子组件 03.子组件传值给父组件 01.组件传值遇到坑 子组件给父组件传值注意点 注意子组件触发事件定义的方法,首先在父组件中需要绑定子组件内部对应事 ...
- 记录转载:Vite多环境配置--让项目拥有更高定制化能力
这里给大家分享我在网上总结出来的一些知识,希望对大家有所帮助 业务背景 近些年来,随着前端工程架构发展,使得前端项目中也能拥有如后端工程的模块能力.正所谓 "能力(越)越大(来),责任(越) ...