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- ...
随机推荐
- [JS] 获取超星视频题答案
// 解除鼠标限制 var btnn = $(document.getElementById("iframe").contentWindow.document.getElement ...
- BeanShell Sample 如何使用?
一 引入: eanShell Sample主要用于生成一些逻辑复杂的数据,例如用于加解密数据: **每次调用前重置bsh.Interpreter:每个BeanShell副本都有自己的解释器副本(每个线 ...
- linux复习基础命令
Linux基础命令 学习目标 了解vm备份的两种方式 了解快照和克隆的区别 了解linux系统文件 掌握基础命令 指定vmtools的作用 1 vm两种备份方式 为什么要进行备份 保证centos操作 ...
- Java //输入两个正整数m和n,求其最大的公约数和最小公倍数//12和20的最大公约数是4,最小公倍数是60
1 //输入两个正整数m和n,求其最大的公约数和最小公倍数 2 //12和20的最大公约数是4,最小公倍数是60 3 4 Scanner scan = new Scanner(System.in); ...
- vagrant 多个box的操作|共享目录失败
本来机器上已经有一个Ubuntu的box了,今天想在安装一个centos的box,结果还折腾了很长时间. 多个机器的命令 添加box的时候需要使用名称,一个的时候可以忽略名称 vagrant box ...
- linux vs code extension C# `GLIBC_2.27' not found
settings中omnisharp:useModernNet改为true reboot虚机
- PDF/Excel文件预览功能完整实现-java版本
新需求 最近接到一个新的需求,说是之前直接下载的PDF文件或者是Excel文件,现在不能直接下载,需要实现在线预览功能. 前端人员拿到这个需求后,去看了一下以前的代码,以前调用的下载接口和PDF文件预 ...
- centos 养成计划
20220720 常用命令 pm2 list pm2 delete all 启动前端 cd /root/website && pm2 start http-server 启动后端 cd ...
- AWS ES ISM学习应用笔记
Elastic Search 6以上版本推出 ILM,用于管理Index的生命周期,但AWS上的ES是基于OSS版本的ES,所以自己开发了ISM来代替ILM.项目是从logstash往ES写入数据,但 ...
- android使用StringRequest访问网站接收JSON时空指针报错
報錯詳情: 代碼詳情: 报错原因:他丫变量名与JSON格式中的变量名不同