MySQL包安装 -- RHEL系列(Yum资源库安装MySQL)

2.2 包安装

2.2.1 RHEL系列

2.2.1.1 Yum资源库安装MySQL

2.2.1.1.1 MySQL 8.0

在"Rocky 8/9、AlmaLinux 8/9、CentOS Stream 8/9、openEuler 22.03/24.03 LTS、AnolisOS 8/23、OpenCloudOS 8/9、Kylin Server v10、UOS Server v20"上安装MySQL:

sql 复制代码
[root@rocky9 ~]# yum list mysql-server --showduplicates
Last metadata expiration check: 0:01:17 ago on Wed 01 Oct 2025 12:47:45 PM CST.
Available Packages
mysql-server.x86_64                                   8.0.43-1.el9_6                                    appstream
​
[root@rocky9 ~]# yum install -y mysql-server
​
[root@rocky9 ~]# systemctl enable --now mysqld
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.
​
[root@rocky9 ~]# ls /var/lib/mysql
 auto.cnf        client-cert.pem      ibdata1         mysql.ibd            mysqlx.sock.lock     server-key.pem
 binlog.000001   client-key.pem       ibtmp1          mysql.sock           performance_schema   sys
 binlog.index   '#ib_16384_0.dblwr'  '#innodb_redo'   mysql.sock.lock      private_key.pem      undo_001
 ca-key.pem     '#ib_16384_1.dblwr'  '#innodb_temp'   mysql_upgrade_info   public_key.pem       undo_002
 ca.pem          ib_buffer_pool       mysql           mysqlx.sock          server-cert.pem
​
[root@rocky9 ~]# mysql -V
mysql  Ver 8.0.43 for Linux on x86_64 (Source distribution)
​
[root@rocky9 ~]# systemctl status mysqld
● mysqld.service - MySQL 8.0 database server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled)
     Active: active (running) since Wed 2025-10-01 12:51:26 CST; 16s ago
    Process: 10501 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
    Process: 10597 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
   Main PID: 13220 (mysqld)
     Status: "Server is operational"
      Tasks: 38 (limit: 10844)
     Memory: 457.0M
        CPU: 3.318s
     CGroup: /system.slice/mysqld.service
             └─13220 /usr/libexec/mysqld --basedir=/usr
​
Oct 01 12:51:20 rocky9 systemd[1]: Starting MySQL 8.0 database server...
Oct 01 12:51:20 rocky9 mysql-prepare-db-dir[10597]: Initializing MySQL database
Oct 01 12:51:26 rocky9 systemd[1]: Started MySQL 8.0 database server.
​
[root@rocky9 ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.43 Source distribution
​
Copyright (c) 2000, 2025, 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> status
--------------
mysql  Ver 8.0.43 for Linux on x86_64 (Source distribution)
​
Connection id:      8
Current database:   
Current user:       root@localhost
SSL:            Not in use
Current pager:      stdout
Using outfile:      ''
Using delimiter:    ;
Server version:     8.0.43 Source distribution
Protocol version:   10
Connection:     Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
UNIX socket:        /var/lib/mysql/mysql.sock
Binary data as:     Hexadecimal
Uptime:         1 min 21 sec
​
Threads: 2  Questions: 5  Slow queries: 0  Opens: 120  Flush tables: 3  Open tables: 36  Queries per second avg: 0.061
--------------
​
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)
​
mysql> exit
Bye

在"Kylin Server V11"上安装MySQL:

vbnet 复制代码
# Kylin Server V11上镜像源默认没有mysql的安装包,需要添加镜像源
[root@kylin11 ~]# cat > /etc/yum.repos.d/mysql-community.repo <<EOF
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=https://mirrors.nju.edu.cn/mysql/yum/mysql-8.0-community/el/9/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.nju.edu.cn/mysql/RPM-GPG-KEY-mysql-2023
EOF
​
[root@kylin11 ~]# yum makecache
​
[root@kylin11 ~]# yum list mysql-community-server --showduplicates
Repository 'mysql' is missing name in configuration, using id.
Last metadata expiration check: 0:00:52 ago on Tue 30 Sep 2025 02:18:00 PM CST.
Available Packages
mysql-community-server.x86_64                                 8.0.30-1.el9                                  mysql
mysql-community-server.x86_64                                 8.0.31-1.el9                                  mysql
mysql-community-server.x86_64                                 8.0.32-1.el9                                  mysql
mysql-community-server.x86_64                                 8.0.33-1.el9                                  mysql
mysql-community-server.x86_64                                 8.0.34-1.el9                                  mysql
mysql-community-server.x86_64                                 8.0.35-1.el9                                  mysql
mysql-community-server.x86_64                                 8.0.36-1.el9                                  mysql
mysql-community-server.x86_64                                 8.0.37-1.el9                                  mysql
mysql-community-server.x86_64                                 8.0.39-1.el9                                  mysql
mysql-community-server.x86_64                                 8.0.40-1.el9                                  mysql
mysql-community-server.x86_64                                 8.0.41-1.el9                                  mysql
mysql-community-server.x86_64                                 8.0.42-1.el9                                  mysql
mysql-community-server.x86_64                                 8.0.43-1.el9                                  mysql
​
[root@kylin11 ~]# yum -y install mysql-community-server
​
[root@kylin11 ~]# systemctl enable --now mysqld
​
[root@kylin11 ~]# ls /var/lib/mysql
 auto.cnf        client-cert.pem      ibdata1         mysql.ibd            public_key.pem    undo_002
 binlog.000001   client-key.pem       ibtmp1          mysql.sock           server-cert.pem
 binlog.index   '#ib_16384_0.dblwr'  '#innodb_redo'   mysql.sock.lock      server-key.pem
 ca-key.pem     '#ib_16384_1.dblwr'  '#innodb_temp'   performance_schema   sys
 ca.pem          ib_buffer_pool       mysql           private_key.pem      undo_001
​
[root@kylin11 ~]# mysql -V
mysql  Ver 8.0.43 for Linux on x86_64 (MySQL Community Server - GPL)
​
[root@kylin11 ~]# systemctl status mysqld
● mysqld.service - MySQL Server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled)
     Active: active (running) since Tue 2025-09-30 14:21:54 CST; 33s ago
       Docs: man:mysqld(8)
             http://dev.mysql.com/doc/refman/en/using-systemd.html
    Process: 3256 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
   Main PID: 3324 (mysqld)
     Status: "Server is operational"
      Tasks: 38 (limit: 8626)
     Memory: 410.0M ()
     CGroup: /system.slice/mysqld.service
             └─3324 /usr/sbin/mysqld
​
Sep 30 14:21:50 kylin11 systemd[1]: Starting MySQL Server...
Sep 30 14:21:54 kylin11 (mysqld)[3324]: mysqld.service: Referenced but unset environment variable evaluates to a>
Sep 30 14:21:54 kylin11 systemd[1]: Started MySQL Server.
​
# 获取MySQL初始密码
[root@kylin11 ~]# grep password /var/log/mysqld.log
2025-09-30T06:21:51.863671Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: ncBFwl5LrR.Y
# "ncBFwl5LrR.Y"就是MySQL的初始密码
​
# 修改mysql密码
[root@kylin11 ~]# mysqladmin -uroot -p'ncBFwl5LrR.Y' password 123456
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
mysqladmin: unable to change password; error: 'Your password does not satisfy the current policy requirements'
# 上面报错提示密码太简单
​
[root@kylin11 ~]# mysqladmin -uroot -p'ncBFwl5LrR.Y' password Raymond@2025
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
​
[root@kylin11 ~]# mysql -uroot -p'Raymond@2025'
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 10
Server version: 8.0.43 MySQL Community Server - GPL
​
Copyright (c) 2000, 2025, 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> status
--------------
mysql  Ver 8.0.43 for Linux on x86_64 (MySQL Community Server - GPL)
​
Connection id:      10
Current database:   
Current user:       root@localhost
SSL:            Not in use
Current pager:      stdout
Using outfile:      ''
Using delimiter:    ;
Server version:     8.0.43 MySQL Community Server - GPL
Protocol version:   10
Connection:     Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
UNIX socket:        /var/lib/mysql/mysql.sock
Binary data as:     Hexadecimal
Uptime:         2 min 22 sec
​
Threads: 2  Questions: 11  Slow queries: 0  Opens: 140  Flush tables: 3  Open tables: 56  Queries per second avg: 0.077
--------------
​
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)
​
mysql> exit
Bye

在"CentOS 7"上安装MySQL:

ini 复制代码
# centos7上镜像源默认没有mysql的安装包,需要添加镜像源
[root@centos7 ~]# cat > /etc/yum.repos.d/mysql-community.repo <<EOF
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=https://mirrors.nju.edu.cn/mysql/yum/mysql-8.0-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.nju.edu.cn/mysql/RPM-GPG-KEY-mysql-2023
EOF
​
[root@centos7 ~]# yum makecache
​
[root@centos7 ~]# yum list mysql-community-server --showduplicates
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Packages
mysql-community-server.x86_64                           8.0.11-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.12-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.13-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.14-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.15-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.16-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.16-2.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.17-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.18-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.19-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.20-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.21-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.22-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.23-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.24-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.25-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.26-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.27-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.28-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.30-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.31-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.32-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.33-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.34-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.35-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.36-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.37-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.39-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.40-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.41-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.42-1.el7                            mysql80-community
mysql-community-server.x86_64                           8.0.43-1.el7                            mysql80-community
​
[root@centos7 ~]# yum -y install mysql-community-server
​
[root@centos7 ~]# systemctl enable --now mysqld
​
[root@centos7 ~]# ls /var/lib/mysql
auto.cnf       ca.pem             #ib_16384_1.dblwr  #innodb_redo  mysql.sock          public_key.pem   undo_001
binlog.000001  client-cert.pem    ib_buffer_pool     #innodb_temp  mysql.sock.lock     server-cert.pem  undo_002
binlog.index   client-key.pem     ibdata1            mysql         performance_schema  server-key.pem
ca-key.pem     #ib_16384_0.dblwr  ibtmp1             mysql.ibd     private_key.pem     sys
​
[root@centos7 ~]# mysql -V
mysql  Ver 8.0.43 for Linux on x86_64 (MySQL Community Server - GPL)
​
[root@centos7 ~]# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2025-10-01 21:00:20 CST; 57s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 1144 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 1210 (mysqld)
   Status: "Server is operational"
   CGroup: /system.slice/mysqld.service
           └─1210 /usr/sbin/mysqld
​
Oct 01 21:00:15 centos7 systemd[1]: Starting MySQL Server...
Oct 01 21:00:20 centos7 systemd[1]: Started MySQL Server.
​
# 获取mysql初始密码
[root@centos7 ~]# grep password /var/log/mysqld.log
2025-10-01T13:00:17.714875Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: sq>;B<_Gj0B+
# "sq>;B<_Gj0B+"就是MySQL的初始密码
​
# 修改mysql密码
[root@centos7 ~]# mysqladmin -uroot -p'sq>;B<_Gj0B+' password 123456
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
mysqladmin: unable to change password; error: 'Your password does not satisfy the current policy requirements'
​
[root@centos7 ~]# mysqladmin -uroot -p'sq>;B<_Gj0B+' password Raymond@2025
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
​
[root@centos7 ~]# mysql -uroot -p'Raymond@2025'
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 9
Server version: 8.0.43 MySQL Community Server - GPL
​
Copyright (c) 2000, 2025, 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> status
--------------
mysql  Ver 8.0.43 for Linux on x86_64 (MySQL Community Server - GPL)
​
Connection id:      9
Current database:   
Current user:       root@localhost
SSL:            Not in use
Current pager:      stdout
Using outfile:      ''
Using delimiter:    ;
Server version:     8.0.43 MySQL Community Server - GPL
Protocol version:   10
Connection:     Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
UNIX socket:        /var/lib/mysql/mysql.sock
Binary data as:     Hexadecimal
Uptime:         2 min 2 sec
​
Threads: 2  Questions: 8  Slow queries: 0  Opens: 130  Flush tables: 3  Open tables: 46  Queries per second avg: 0.065
--------------
​
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)
​
mysql> exit
Bye
2.2.1.1.2 MySQL 8.4

在"Rocky 10、AlmaLinux 10和CentOS Stream 10"上安装MySQL:

sql 复制代码
[root@rocky10 ~]# yum list mysql*-server --showduplicates
Last metadata expiration check: 0:05:14 ago on Wed 01 Oct 2025 01:34:43 PM CST.
Available Packages
mysql8.4-server.x86_64                                  8.4.4-2.el10                                    appstream
mysql8.4-server.x86_64                                  8.4.6-2.el10_0                                  appstream
​
[root@rocky10 ~]# yum install -y mysql8.4-server
​
[root@rocky10 ~]# systemctl enable --now mysqld
​
[root@rocky10 ~]# ls /var/lib/mysql
 auto.cnf          client-key.pem      '#innodb_redo'     mysql_upgrade_history   public_key.pem
 binlog.000001    '#ib_16384_0.dblwr'  '#innodb_temp'     mysql_upgrade_info      server-cert.pem
 binlog.index     '#ib_16384_1.dblwr'   mysql             mysqlx.sock             server-key.pem
 ca-key.pem        ib_buffer_pool       mysql.ibd         mysqlx.sock.lock        sys
 ca.pem            ibdata1              mysql.sock        performance_schema      undo_001
 client-cert.pem   ibtmp1               mysql.sock.lock   private_key.pem         undo_002
​
[root@rocky10 ~]# mysql -V
mysql  Ver 8.4.6 for Linux on x86_64 (Source distribution)
​
[root@rocky10 ~]# systemctl status mysqld
● mysqld.service - MySQL 8.4 database server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled)
     Active: active (running) since Wed 2025-10-01 13:41:42 CST; 28s ago
 Invocation: f51300fb7d2d42faa53388d3f65cd5db
    Process: 1584 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
    Process: 1607 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
   Main PID: 1679 (mysqld)
     Status: "Server is operational"
      Tasks: 35 (limit: 10481)
     Memory: 432M (peak: 446.4M)
        CPU: 3.055s
     CGroup: /system.slice/mysqld.service
             └─1679 /usr/libexec/mysqld --basedir=/usr
​
Oct 01 13:41:38 rocky10 systemd[1]: Starting mysqld.service - MySQL 8.4 database server...
Oct 01 13:41:38 rocky10 mysql-prepare-db-dir[1607]: Initializing MySQL database
Oct 01 13:41:42 rocky10 systemd[1]: Started mysqld.service - MySQL 8.4 database server.
​
[root@rocky10 ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.4.6 Source distribution
​
Copyright (c) 2000, 2025, 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> status
--------------
mysql  Ver 8.4.6 for Linux on x86_64 (Source distribution)
​
Connection id:      8
Current database:   
Current user:       root@localhost
SSL:            Not in use
Current pager:      stdout
Using outfile:      ''
Using delimiter:    ;
Server version:     8.4.6 Source distribution
Protocol version:   10
Connection:     Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
UNIX socket:        /var/lib/mysql/mysql.sock
Binary data as:     Hexadecimal
Uptime:         52 sec
​
Threads: 2  Questions: 6  Slow queries: 0  Opens: 120  Flush tables: 3  Open tables: 36  Queries per second avg: 0.115
--------------
​
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)
​
mysql> exit
Bye

在"Rocky 8/9、AlmaLinux 8/9、CentOS Stream 8/9、openEuler 22.03/24.03 LTS、AnolisOS 8/23、OpenCloudOS 8/9、Kylin Server v10/v11、UOS Server v20"上安装MySQL:

去"www.mysql.com/"网站下载,选择"DOWNLOADS",如图2所示。

图2 下载Yum仓库包

选择"MySQL Community (GPL) Downloads",如图3所示。

图3 下载Yum仓库包

选择"MySQL Yum Repository(MySQL Yum资源库)",如图4所示。

图4 下载Yum仓库包

然后根据系统版本下载相应的安装包,如图5所示。

图5 下载Yum仓库包

在"Rocky 9、AlmaLinux 9、CentOS Stream 9、openEuler 24.03 LTS、AnolisOS 23、OpenCloudOS 9、Kylin Server v11"上安装MySQL:

方法1:下载官方yum仓库安装包,并安装

csharp 复制代码
# Rocky、Almalinux、CentOS、AnolisOS、OpenCloudOS、Kylin Server默认没有wget包,需要安装
yum install -y wget
​
[root@rocky9 ~]# wget https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm
​
[root@rocky9 ~]# rpm -ivh mysql84-community-release-el9-1.noarch.rpm
​
# 替换国内镜像源
sed -i.bak 's|http://repo.mysql.com|https://mirrors.nju.edu.cn/mysql|g' /etc/yum.repos.d/mysql-community*.repo

方法2:添加镜像源

ini 复制代码
[root@rocky9 ~]# cat > /etc/yum.repos.d/mysql-community.repo <<EOF
[mysql-8.4-lts-community]
name=MySQL 8.4 LTS Community Server
baseurl=https://mirrors.nju.edu.cn/mysql/yum/mysql-8.4-community/el/9/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.nju.edu.cn/mysql/RPM-GPG-KEY-mysql-2023
EOF

继续安装MySQL:

vbnet 复制代码
[root@rocky9 ~]# yum makecache
​
[root@rocky9 ~]# yum list mysql-community-server --showduplicates
Last metadata expiration check: 0:00:09 ago on Wed 01 Oct 2025 02:09:04 PM CST.
Available Packages
mysql-community-server.x86_64                         8.4.0-1.el9                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.2-1.el9                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.3-1.el9                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.4-1.el9                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.5-1.el9                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.6-1.el9                         mysql-8.4-lts-community
​
[root@rocky9 ~]# yum install -y mysql-community-server
​
[root@rocky9 ~]# systemctl enable --now mysqld
​
[root@rocky9 ~]# ls /var/lib/mysql
 auto.cnf        client-cert.pem      ibdata1         mysql.ibd               private_key.pem   undo_001
 binlog.000001   client-key.pem       ibtmp1          mysql.sock              public_key.pem    undo_002
 binlog.index   '#ib_16384_0.dblwr'  '#innodb_redo'   mysql.sock.lock         server-cert.pem
 ca-key.pem     '#ib_16384_1.dblwr'  '#innodb_temp'   mysql_upgrade_history   server-key.pem
 ca.pem          ib_buffer_pool       mysql           performance_schema      sys
​
[root@rocky9 ~]# mysql -V
mysql  Ver 8.4.6 for Linux on x86_64 (MySQL Community Server - GPL)
​
[root@rocky9 ~]# systemctl status mysqld
● mysqld.service - MySQL Server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled)
     Active: active (running) since Wed 2025-10-01 14:10:09 CST; 23s ago
       Docs: man:mysqld(8)
             http://dev.mysql.com/doc/refman/en/using-systemd.html
    Process: 12982 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
   Main PID: 13160 (mysqld)
     Status: "Server is operational"
      Tasks: 35 (limit: 10844)
     Memory: 434.4M
        CPU: 3.117s
     CGroup: /system.slice/mysqld.service
             └─13160 /usr/sbin/mysqld
​
Oct 01 14:10:04 rocky9 systemd[1]: Starting MySQL Server...
Oct 01 14:10:09 rocky9 systemd[1]: Started MySQL Server.
​
# 获取MySQL初始密码
[root@rocky9 ~]# grep password /var/log/mysqld.log
2025-10-01T06:10:06.123825Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: %1i8Dj&l#dei
# "%1i8Dj&l#dei"就是MySQL的初始密码
​
# 修改mysql密码
[root@rocky9 ~]# mysqladmin -uroot -p'%1i8Dj&l#dei' password 123456
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
mysqladmin: unable to change password; error: 'Your password does not satisfy the current policy requirements'
# 上面报错提示密码太简单
​
[root@rocky9 ~]# mysqladmin -uroot -p'%1i8Dj&l#dei' password Raymond@2025
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
​
[root@rocky9 ~]# mysql -uroot -p'Raymond@2025'
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 9
Server version: 8.4.6 MySQL Community Server - GPL
​
Copyright (c) 2000, 2025, 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> status
--------------
mysql  Ver 8.4.6 for Linux on x86_64 (MySQL Community Server - GPL)
​
Connection id:      9
Current database:   
Current user:       root@localhost
SSL:            Not in use
Current pager:      stdout
Using outfile:      ''
Using delimiter:    ;
Server version:     8.4.6 MySQL Community Server - GPL
Protocol version:   10
Connection:     Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
UNIX socket:        /var/lib/mysql/mysql.sock
Binary data as:     Hexadecimal
Uptime:         1 min 23 sec
​
Threads: 2  Questions: 9  Slow queries: 0  Opens: 130  Flush tables: 3  Open tables: 46  Queries per second avg: 0.108
--------------
​
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)
​
mysql> exit
Bye

在"Rocky 8、AlmaLinux 8、CentOS Stream 8、AnolisOS 8、OpenCloudOS 8"上安装MySQL:

方法1:下载官方yum仓库安装包,并安装

csharp 复制代码
# Rocky、Almalinux、CentOS、AnolisOS、OpenCloudOS、Kylin Server默认没有wget包,需要安装
yum install -y wget
​
[root@rocky8 ~]# wget https://dev.mysql.com/get/mysql84-community-release-el8-1.noarch.rpm
​
[root@rocky8 ~]# rpm -ivh mysql84-community-release-el8-1.noarch.rpm
​
# 替换国内镜像源
sed -i.bak 's|http://repo.mysql.com|https://mirrors.nju.edu.cn/mysql|g' /etc/yum.repos.d/mysql-community*.repo

方法2:添加镜像源

ini 复制代码
[root@rocky8 ~]# cat > /etc/yum.repos.d/mysql.repo <<EOF
[mysql-8.4-lts-community]
name=MySQL 8.4 LTS Community Server
baseurl=https://mirrors.nju.edu.cn/mysql/yum/mysql-8.4-community/el/8/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.nju.edu.cn/mysql/RPM-GPG-KEY-mysql-2023
EOF

继续安装MySQL:

less 复制代码
[root@rocky8 ~]# yum makecache
​
[root@rocky8 ~]# yum list mysql-community-server --showduplicates
Last metadata expiration check: 0:01:43 ago on Sat 12 Apr 2025 11:29:44 PM CST.
Error: No matching Packages to list
# 找不到安装包
​
# 禁用默认的mysql模块
[root@rocky8 ~]# yum module -y disable mysql
​
[root@rocky8 ~]# yum list mysql-community-server --showduplicates
Last metadata expiration check: 0:01:21 ago on Tue 30 Sep 2025 05:14:06 PM CST.
Available Packages
mysql-community-server.x86_64                         8.4.0-1.el8                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.2-1.el8                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.3-1.el8                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.4-1.el8                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.5-1.el8                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.6-1.el8                         mysql-8.4-lts-community
​
[root@rocky8 ~]# yum install -y mysql-community-server
​
[root@rocky8 ~]# systemctl enable --now mysqld
​
[root@rocky8 ~]# ls /var/lib/mysql
 auto.cnf        client-cert.pem      ibdata1         mysql.ibd               private_key.pem   undo_001
 binlog.000001   client-key.pem       ibtmp1          mysql.sock              public_key.pem    undo_002
 binlog.index   '#ib_16384_0.dblwr'  '#innodb_redo'   mysql.sock.lock         server-cert.pem
 ca-key.pem     '#ib_16384_1.dblwr'  '#innodb_temp'   mysql_upgrade_history   server-key.pem
 ca.pem          ib_buffer_pool       mysql           performance_schema      sys
​
[root@rocky8 ~]# mysql -V
mysql  Ver 8.4.6 for Linux on x86_64 (MySQL Community Server - GPL)
​
[root@rocky8 ~]# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2025-09-30 17:16:45 CST; 30s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 11790 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 11856 (mysqld)
   Status: "Server is operational"
    Tasks: 35 (limit: 10941)
   Memory: 437.4M
   CGroup: /system.slice/mysqld.service
           └─11856 /usr/sbin/mysqld
​
Sep 30 17:16:40 rocky8 systemd[1]: Starting MySQL Server...
Sep 30 17:16:45 rocky8 systemd[1]: Started MySQL Server.
​
# 获取MySQL初始密码
[root@rocky8 ~]# grep password /var/log/mysqld.log
2025-09-30T09:16:41.829874Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: )Faks7D=N>(e
# ")Faks7D=N>(e"就是MySQL的初始密码
​
# 修改mysql密码
[root@rocky8 ~]# mysqladmin -uroot -p')Faks7D=N>(e' password 123456
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
mysqladmin: unable to change password; error: 'Your password does not satisfy the current policy requirements'
# 上面报错提示密码太简单
​
[root@rocky8 ~]# mysqladmin -uroot -p')Faks7D=N>(e' password Raymond@2025
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
​
[root@rocky8 ~]# mysql -uroot -p'Raymond@2025'
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 11
Server version: 8.4.6 MySQL Community Server - GPL
​
Copyright (c) 2000, 2025, 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> status
--------------
mysql  Ver 8.4.6 for Linux on x86_64 (MySQL Community Server - GPL)
​
Connection id:      11
Current database:   
Current user:       root@localhost
SSL:            Not in use
Current pager:      stdout
Using outfile:      ''
Using delimiter:    ;
Server version:     8.4.6 MySQL Community Server - GPL
Protocol version:   10
Connection:     Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
UNIX socket:        /var/lib/mysql/mysql.sock
Binary data as:     Hexadecimal
Uptime:         2 min 8 sec
​
Threads: 2  Questions: 12  Slow queries: 0  Opens: 140  Flush tables: 3  Open tables: 56  Queries per second avg: 0.093
--------------
​
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)
​
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)
​
mysql> exit
Bye

在"openEuler 22.03 LTS、Kylin Server v10、UOS Server v20"上安装MySQL:

方法1:下载官方yum仓库安装包,并安装

csharp 复制代码
# Rocky、Almalinux、CentOS、AnolisOS、OpenCloudOS、Kylin Server默认没有wget包,需要安装
yum install -y wget
​
[root@openeuler22 ~]# wget https://dev.mysql.com/get/mysql84-community-release-el8-1.noarch.rpm
​
[root@openeuler22 ~]# rpm -ivh mysql84-community-release-el8-1.noarch.rpm
​
# 替换国内镜像源
sed -i.bak 's|http://repo.mysql.com|https://mirrors.nju.edu.cn/mysql|g' /etc/yum.repos.d/mysql-community*.repo

方法2:添加镜像源

ini 复制代码
[root@openeuler22 ~]# cat > /etc/yum.repos.d/mysql.repo <<EOF
[mysql-8.4-lts-community]
name=MySQL 8.4 LTS Community Server
baseurl=https://mirrors.nju.edu.cn/mysql/yum/mysql-8.4-community/el/8/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.nju.edu.cn/mysql/RPM-GPG-KEY-mysql-2023
EOF

继续安装MySQL:

vbnet 复制代码
[root@openeuler22 ~]# yum makecache
​
[root@openeuler22 ~]# yum list mysql-community-server --showduplicates
Last metadata expiration check: 0:01:49 ago on Wed 01 Oct 2025 02:17:26 PM CST.
Available Packages
mysql-community-server.x86_64                         8.4.0-1.el8                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.2-1.el8                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.3-1.el8                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.4-1.el8                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.5-1.el8                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.6-1.el8                         mysql-8.4-lts-community
​
[root@openeuler22 ~]# yum install -y mysql-community-server
​
[root@openeuler22 ~]# systemctl enable --now mysqld
​
[root@openeuler22 ~]# ls /var/lib/mysql
 auto.cnf        client-cert.pem      ibdata1         mysql.ibd               private_key.pem   undo_001
 binlog.000001   client-key.pem       ibtmp1          mysql.sock              public_key.pem    undo_002
 binlog.index   '#ib_16384_0.dblwr'  '#innodb_redo'   mysql.sock.lock         server-cert.pem
 ca-key.pem     '#ib_16384_1.dblwr'  '#innodb_temp'   mysql_upgrade_history   server-key.pem
 ca.pem          ib_buffer_pool       mysql           performance_schema      sys
​
[root@openeuler22 ~]# mysql -V
mysql  Ver 8.4.6 for Linux on x86_64 (MySQL Community Server - GPL)
​
[root@openeuler22 ~]# systemctl status mysqld
● mysqld.service - MySQL Server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
     Active: active (running) since Wed 2025-10-01 14:20:27 CST; 1min 52s ago
       Docs: man:mysqld(8)
             http://dev.mysql.com/doc/refman/en/using-systemd.html
    Process: 1746 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
   Main PID: 1811 (mysqld)
     Status: "Server is operational"
      Tasks: 34 (limit: 8944)
     Memory: 436.7M
     CGroup: /system.slice/mysqld.service
             └─ 1811 /usr/sbin/mysqld
​
Oct 01 14:20:23 openeuler22 systemd[1]: Starting MySQL Server...
Oct 01 14:20:27 openeuler22 systemd[1]: Started MySQL Server.
​
# 获取MySQL初始密码
[root@openeuler22 ~]# grep password /var/log/mysqld.log
2025-10-01T06:20:24.661048Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: lpMLhfZ4%*gX
# "lpMLhfZ4%*gX"就是MySQL的初始密码
​
# 修改mysql密码
[root@openeuler22 ~]#  mysqladmin -uroot -p'lpMLhfZ4%*gX' password 123456
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
mysqladmin: unable to change password; error: 'Your password does not satisfy the current policy requirements'
# 上面报错提示密码太简单
​
[root@openeuler22 ~]# mysqladmin -uroot -p'lpMLhfZ4%*gX' password Raymond@2025
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
​
[root@openeuler22 ~]# mysql -uroot -p'Raymond@2025'
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 9
Server version: 8.4.6 MySQL Community Server - GPL
​
Copyright (c) 2000, 2025, 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> status
--------------
mysql  Ver 8.4.6 for Linux on x86_64 (MySQL Community Server - GPL)
​
Connection id:      9
Current database:   
Current user:       root@localhost
SSL:            Not in use
Current pager:      stdout
Using outfile:      ''
Using delimiter:    ;
Server version:     8.4.6 MySQL Community Server - GPL
Protocol version:   10
Connection:     Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
UNIX socket:        /var/lib/mysql/mysql.sock
Binary data as:     Hexadecimal
Uptime:         2 min 50 sec
​
Threads: 2  Questions: 9  Slow queries: 0  Opens: 130  Flush tables: 3  Open tables: 46  Queries per second avg: 0.052
--------------
​
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)
​
mysql> exit
Bye

在"CentOS 7"上安装MySQL:

方法1:下载官方yum仓库安装包,并安装

csharp 复制代码
# Rocky、Almalinux、CentOS、AnolisOS、OpenCloudOS、Kylin Server默认没有wget包,需要安装
[root@centos7 ~]# yum install -y wget
​
[root@centos7 ~]# wget https://dev.mysql.com/get/mysql84-community-release-el7-1.noarch.rpm
​
[root@centos7 ~]# rpm -ivh mysql84-community-release-el7-1.noarch.rpm
​
# 替换国内镜像源
sed -i.bak 's|http://repo.mysql.com|https://mirrors.nju.edu.cn/mysql|g' /etc/yum.repos.d/mysql-community*.repo

方法2:添加镜像源

ini 复制代码
[root@centos7 ~]# cat > /etc/yum.repos.d/mysql.repo <<EOF
[mysql-8.4-lts-community]
name=MySQL 8.4 LTS Community Server
baseurl=https://mirrors.nju.edu.cn/mysql/yum/mysql-8.4-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://mirrors.nju.edu.cn/mysql/RPM-GPG-KEY-mysql-2023
EOF

继续安装MySQL:

vbnet 复制代码
[root@centos7 ~]# yum makecache
​
[root@centos7 ~]# yum list mysql-community-server --showduplicates
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Packages
mysql-community-server.x86_64                         8.4.0-1.el7                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.2-1.el7                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.3-1.el7                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.4-1.el7                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.5-1.el7                         mysql-8.4-lts-community
mysql-community-server.x86_64                         8.4.6-1.el7                         mysql-8.4-lts-community
​
[root@centos7 ~]# yum install -y mysql-community-server
​
[root@centos7 ~]# systemctl enable --now mysqld
​
[root@centos7 ~]# ls /var/lib/mysql
auto.cnf       client-cert.pem    ibdata1       mysql.ibd              private_key.pem  undo_001
binlog.000001  client-key.pem     ibtmp1        mysql.sock             public_key.pem   undo_002
binlog.index   #ib_16384_0.dblwr  #innodb_redo  mysql.sock.lock        server-cert.pem
ca-key.pem     #ib_16384_1.dblwr  #innodb_temp  mysql_upgrade_history  server-key.pem
ca.pem         ib_buffer_pool     mysql         performance_schema     sys
​
[root@centos7 ~]# mysql -V
mysql  Ver 8.4.6 for Linux on x86_64 (MySQL Community Server - GPL)
​
[root@centos7 ~]# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2025-10-01 22:34:48 CST; 27s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 1148 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 1212 (mysqld)
   Status: "Server is operational"
   CGroup: /system.slice/mysqld.service
           └─1212 /usr/sbin/mysqld
​
Oct 01 22:34:43 centos7 systemd[1]: Starting MySQL Server...
Oct 01 22:34:48 centos7 systemd[1]: Started MySQL Server.
​
# 获取mysql初始密码
[root@centos7 ~]# grep password /var/log/mysqld.log
2025-10-01T14:34:45.284547Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: y2rAF8a-w_9=
# "y2rAF8a-w_9="就是mysql的初始密码
​
# 修改mysql密码
[root@centos7 ~]# mysqladmin -uroot -p'y2rAF8a-w_9=' password 123456
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
mysqladmin: unable to change password; error: 'Your password does not satisfy the current policy requirements'
# 上面报错提示密码太简单
​
[root@centos7 ~]# mysqladmin -uroot -p'y2rAF8a-w_9=' password Raymond@2025
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
​
[root@centos7 ~]# mysql -uroot -p'Raymond@2025'
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 9
Server version: 8.4.6 MySQL Community Server - GPL
​
Copyright (c) 2000, 2025, 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> status
--------------
mysql  Ver 8.4.6 for Linux on x86_64 (MySQL Community Server - GPL)
​
Connection id:      9
Current database:   
Current user:       root@localhost
SSL:            Not in use
Current pager:      stdout
Using outfile:      ''
Using delimiter:    ;
Server version:     8.4.6 MySQL Community Server - GPL
Protocol version:   10
Connection:     Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
UNIX socket:        /var/lib/mysql/mysql.sock
Binary data as:     Hexadecimal
Uptime:         1 min 24 sec
​
Threads: 2  Questions: 9  Slow queries: 0  Opens: 130  Flush tables: 3  Open tables: 46  Queries per second avg: 0.107
--------------
​
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)
​
mysql> exit
Bye
相关推荐
夜月yeyue2 小时前
ART 加速器、流水线与指令预测的关系详解
linux·服务器·c语言·单片机·嵌入式硬件·性能优化·嵌入式高阶技巧
---学无止境---3 小时前
Linux中select的实现
linux
bst@微胖子3 小时前
Harmony中EventHub实现发布订阅
linux·运维·ubuntu
爱奥尼欧3 小时前
【Linux】系统部分——线程安全与线程的单例模式
linux·安全·单例模式
他们叫我技术总监3 小时前
Oracle数据库常见问题实战:从连接错误到自动清理空闲会话
数据库·oracle
尹蓝锐5 小时前
在学校Linux服务器上配置go语言环境
linux·运维·服务器
菲兹园长5 小时前
MySql(SQL)
数据库·sql·mysql
一只小bit6 小时前
MySQL表的操作:创建—修改—删除流程解析
数据库·mysql·oracle
做运维的阿瑞6 小时前
PostgreSQL 从入门到精通:Windows 环境下安装与使用指南
数据库·windows·postgresql