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.
This is the easiest and recommended approach, since official packages are pre-built and tested for your system.
First, back up your data (always a good habit before modifying MySQL installations):
mysqldump -u root -p --all-databases > mysql_full_backup.sqlEnter your root password when prompted, and store this backup in a safe place.
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/mysqlAdd 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.debUpdate your package lists:
sudo apt-get updateInstall MySQL Server + Group Replication plugin:
sudo apt-get install mysql-server mysql-community-plugin-group-replicationFollow the prompts to set your root password and complete the installation.
Verify the plugin exists:
Check the default plugin directory:ls /usr/lib/mysql/plugin/ | grep group_replicationYou should see
group_replication.solisted. Now you can run theINSTALL PLUGINcommand in MySQL without errors.
If the official packages don't work for your setup (e.g., custom MySQL configurations), compiling from source is a solid alternative.
Install build dependencies:
sudo apt-get install build-essential cmake libncurses5-dev libssl-dev bison gitDownload 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-serverThis pulls the exact codebase for MySQL 5.7.21 from the official public repository.
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 toboostin 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 boostConfigure 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/mysqlThese flags ensure the plugin installs to your existing MySQL plugin directory and aligns with your system's setup.
Compile the plugin:
Use all your CPU cores to speed up the compilation process:make -j$(nproc)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.soVerify and install the plugin in MySQL:
Restart MySQL, then run theINSTALL PLUGIN group_replication SONAME 'group_replication.so';command—it should succeed now.
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

