建立使用環境

  1. 遠端登入 kvm3.deyu.wang 虛擬機。
    [root@deyu ~]# ssh root@kvm3.deyu.wang
    root@kvm3.deyu.wang's password: 
    Last login: Thu Feb 23 14:00:26 2023 from 192.168.122.1
    [root@kvm3 ~]#
    
  2. 安裝 mariadb-server。
    [root@kvm3 ~]# dnf install mariadb-server
    
  3. 設定開機自動啟動 mariadb 服務,且馬上啟動。
    [root@kvm3 ~]# systemctl enable --now mariadb.service 
    Created symlink /etc/systemd/system/mysql.service →
     /usr/lib/systemd/system/mariadb.service.
    Created symlink /etc/systemd/system/mysqld.service →
     /usr/lib/systemd/system/mariadb.service.
    Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service →
     /usr/lib/systemd/system/mariadb.service.
    
  4. 查看 mariadb 服務狀態,啟動成功,沒有警告訊息。
    [root@kvm3 ~]# systemctl status mariadb.service
    ● mariadb.service - MariaDB 10.5 database server
         Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
         Active: active (running) since Thu 2023-02-23 17:11:35 CST; 49s ago
           Docs: man:mariadbd(8)
                 https://mariadb.com/kb/en/library/systemd/
        Process: 12920 ExecStartPre=/usr/libexec/mariadb-check-socket (code=exited, status=0/SUCCESS)
        Process: 12942 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS)
        Process: 13035 ExecStartPost=/usr/libexec/mariadb-check-upgrade (code=exited, status=0/SUCCESS)
       Main PID: 13023 (mariadbd)
         Status: "Taking your SQL requests now..."
          Tasks: 11 (limit: 11068)
         Memory: 77.5M
            CPU: 951ms
         CGroup: /system.slice/mariadb.service
                 └─13023 /usr/libexec/mariadbd --basedir=/usr
    
    Feb 23 17:11:35 .....: you need to be the system 'mysql' user to connect.
    Feb 23 17:11:35 .....: After connecting you can set the password, if you would need to be
    Feb 23 17:11:35 .....: able to connect as any of these users with a password and without sudo
    Feb 23 17:11:35 .....: See the MariaDB Knowledgebase at https://mariadb.com/kb
    Feb 23 17:11:35 .....: Please report any problems at https://mariadb.org/jira
    Feb 23 17:11:35 .....: The latest information about MariaDB is available at https://mariadb.org/.
    Feb 23 17:11:35 .....: Consider joining MariaDB's strong and vibrant community:
    Feb 23 17:11:35 .....: https://mariadb.org/get-involved/
    Feb 23 17:11:35 ..... [Note] /usr/libexec/mariadbd (mysqld 10.5.16-MariaDB) starting as process 13023 ...
    Feb 23 17:11:35 kvm3.deyu.wang systemd[1]: Started MariaDB 10.5 database server.
    
  5. 查看 mariadb 版本。
    [root@kvm3 ~]# mysqladmin --version
    mysqladmin  Ver 9.1 Distrib 10.5.16-MariaDB, for Linux on x86_64
    
  6. 查看 mariadb port 為 3306。
    [root@kvm3 ~]# ss -ltpn | grep mariadb
    LISTEN 0      80          *:3306     *:*    users:(("mariadbd",pid=13023,fd=19))