在 CentOS/RHEL 使用 RPM 直接安裝 MySQL 官方套件時,常遇到:
file /usr/share/mysql/charsets/Index.xml from install of MySQL-server-5.5.32-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.61-4.el6.x86_64 file /usr/share/mysql/charsets/armscii8.xml ... conflicts with mysql-libs-5.1.61-4.el6.x86_64 ...
原因:系統預裝的 mysql-libs (舊版 5.1) 佔用了 /usr/share/mysql/charsets/ 等文件,與新版 RPM 衝突。
yum -y remove mysql-libs-5.1.61*-y 自動確認,避免互動提示)rpm -ivh MySQL-server-5.5.32-1.el6.x86_64.rpmPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password' Alternatively you can run: /usr/bin/mysql_secure_installation ...
依提示執行 mysql_secure_installation 完成安全初始化 (設定 root 密碼、移除匿名用戶、禁止遠程 root、移除 test 庫)。
yum -y remove mariadb-libs # 然後再安裝 MySQL 官方 RPM 或使用官方 yum repo