You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu16.04下MySQL5.7.21安装Group Replication插件报错求助

Hey there, let's fix that missing group_replication.so issue you're hitting with MySQL 5.7.21 on Ubuntu 16.04. This problem usually pops up because your MySQL installation didn't include the Group Replication plugin by default—let's walk through two reliable solutions to get you back on track.

方法1:通过官方MySQL APT仓库补装插件包

This is the easiest and recommended approach, since official packages are pre-built and tested for your system.

  1. First, back up your data (always a good habit before modifying MySQL installations):

    mysqldump -u root -p --all-databases > mysql_full_backup.sql
    

    Enter your root password when prompted, and store this backup in a safe place.

  2. Remove any existing non-official MySQL packages (if you installed via Ubuntu's default repos, which often lack the Group Replication plugin):

    sudo apt-get remove --purge mysql-server mysql-client mysql-common
    sudo apt-get autoremove
    sudo rm -rf /var/lib/mysql /etc/mysql
    
  3. Add the official MySQL APT repository:
    Download the repository configuration package from the official MySQL website (look for the MySQL APT Config package compatible with Ubuntu 16.04). Install it, and when prompted, select MySQL 5.7 as the default version, then confirm your choice:

    sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb
    
  4. Update your package lists:

    sudo apt-get update
    
  5. Install MySQL Server + Group Replication plugin:

    sudo apt-get install mysql-server mysql-community-plugin-group-replication
    

    Follow the prompts to set your root password and complete the installation.

  6. Verify the plugin exists:
    Check the default plugin directory:

    ls /usr/lib/mysql/plugin/ | grep group_replication
    

    You should see group_replication.so listed. Now you can run the INSTALL PLUGIN command in MySQL without errors.

方法2:从源码编译Group Replication插件

If the official packages don't work for your setup (e.g., custom MySQL configurations), compiling from source is a solid alternative.

  1. Install build dependencies:

    sudo apt-get install build-essential cmake libncurses5-dev libssl-dev bison git
    
  2. Download the exact MySQL 5.7.21 source code:
    Use Git to clone the official MySQL Server repository and check out the 5.7.21 version tag:

    git clone https://github.com/mysql/mysql-server.git -b mysql-5.7.21
    cd mysql-server
    

    This pulls the exact codebase for MySQL 5.7.21 from the official public repository.

  3. Download the required Boost library (MySQL 5.7.21 requires Boost 1.59.0):
    Download Boost 1.59.0 from its official source, extract it, and rename the folder to boost in the MySQL source directory:

    # Example commands (adjust based on your downloaded file name)
    tar xzf boost_1_59_0.tar.gz
    mv boost_1_59_0 boost
    
  4. Configure the build with Group Replication enabled:
    Create a build directory and run CMake with flags that match your system's MySQL paths:

    mkdir build && cd build
    cmake .. -DWITH_BOOST=../boost -DWITH_GROUP_REPLICATION=ON -DCMAKE_INSTALL_PREFIX=/usr -DMYSQL_DATADIR=/var/lib/mysql -DSYSCONFDIR=/etc/mysql
    

    These flags ensure the plugin installs to your existing MySQL plugin directory and aligns with your system's setup.

  5. Compile the plugin:
    Use all your CPU cores to speed up the compilation process:

    make -j$(nproc)
    
  6. Install the compiled plugin:
    Copy the plugin to MySQL's plugin directory and set correct permissions:

    sudo cp plugin/group_replication/libgroup_replication.so /usr/lib/mysql/plugin/group_replication.so
    sudo chmod 755 /usr/lib/mysql/plugin/group_replication.so
    
  7. Verify and install the plugin in MySQL:
    Restart MySQL, then run the INSTALL PLUGIN group_replication SONAME 'group_replication.so'; command—it should succeed now.

Quick Post-Fix Checks

Before configuring Group Replication fully, make sure your MySQL config (usually located at /etc/mysql/mysql.conf.d/mysqld.cnf) has these mandatory settings:

gtid_mode=ON
enforce_gtid_consistency=ON
loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "your-server-ip:33061"
loose-group_replication_group_seeds= "your-server-ip:33061,other-node-ip:33061"
loose-group_replication_bootstrap_group=off

Restart MySQL after updating the config to apply these changes.

内容的提问来源于stack exchange,提问作者TrickyExplorer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 03:30:53