1.2. Using containers to run multiple MariaDB and MySQL instances on a single host


If you install MariaDB or MySQL from packages, you can only run one of these services and only a single version of it on the same host. As an alternative, you can run the services in a container.

You can configure the following scenarios:

  • You want to run multiple instances of MariaDB or MySQL on the same host.
  • You want to run both MariaDB and MySQL on the same host.

Prerequisites

  • The podman package is installed.

Procedure

  1. Authenticate to the registry.redhat.io registry by using your Red Hat Customer Portal account:

    # podman login registry.redhat.io

    Skip this step if you are already logged in to the container registry.

  2. Start the containers you want to use:

    • MariaDB 10.11:

      $ podman run -d --name <container_name_1> -e MYSQL_ROOT_PASSWORD=<password> -p <host_port_1>:3306 rhel10/mariadb-1011

      For more information about the usage of this container image, see the Red Hat Ecosystem Catalog.

    • MySQL 8.4:

      $ podman run -d --name <container_name_2> -e MYSQL_ROOT_PASSWORD=<password> -p <host_port_2>:3306 rhel10/mysql-84

      For more information about the usage of this container image, see the Red Hat Ecosystem Catalog.

    重要

    The container names and host ports of the two database servers must differ.

  3. To ensure that clients can access the database server on the network, open the host ports in the firewall:

    # firewall-cmd --permanent --add-port={<host_port_1>/tcp,<host_port_2>/tcp,...}
    # firewall-cmd --reload

Verification

  1. Connect to the database server and log in as root:

    # mysql -u root -p -h localhost -P <host_port> --protocol tcp
  2. Optional: Display information about the running containers:

    $ podman ps
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部