我想简单地用 ruby 2.3 更新 rvm:
rvm install ruby-2.3.0
但我遇到了一些依赖性问题:
Error running 'requirements_debian_libs_remove libssl-dev',
please read /home/john/.rvm/log/1568069021_ruby-2.3.0/package_remove_libssl-dev.log
日志文件告诉我该问题与 mariadb 有关:
tail -n 100 /home/john/.rvm/log/1568069021_ruby-2.3.0/package_remove_libssl-dev.log
The following packages have unmet dependencies:
mariadb-server : Depends: mariadb-server-10.1 (= 1:10.1.41+maria-1~bionic) but 1:10.1.40-0ubuntu0.18.04.1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
我试图让它解决依赖问题,但没有成功:
sudo apt --fix-broken install
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
dpkg: regarding .../mariadb-server-core-10.1_1%3a10.1.41+maria-1~bionic_amd64.deb containing mariadb-server-core-10.1:
mariadb-server-10.1 conflicts with mysql-server-core-5.5
mariadb-server-core-10.1 provides mysql-server-core-5.5 and is to be installed.
dpkg: error processing archive /var/cache/apt/archives/mariadb-server-core-10.1_1%3a10.1.41+maria-1~bionic_amd64.deb (--unpack):
conflicting packages - not installing mariadb-server-core-10.1
dpkg: regarding .../mariadb-client-core-10.1_1%3a10.1.41+maria-1~bionic_amd64.deb containing mariadb-client-core-10.1:
mariadb-client-10.1 conflicts with mysql-client-core-5.5
mariadb-client-core-10.1 provides mysql-client-core-5.5 and is to be installed.
dpkg: error processing archive /var/cache/apt/archives/mariadb-client-core-10.1_1%3a10.1.41+maria-1~bionic_amd64.deb (--unpack):
conflicting packages - not installing mariadb-client-core-10.1
dpkg: regarding .../mariadb-client-10.1_1%3a10.1.41+maria-1~bionic_amd64.deb containing mariadb-client-10.1:
mariadb-client-core-10.1 conflicts with mysql-client-5.5
mariadb-client-10.1 provides mysql-client-5.5 and is to be installed.
dpkg: error processing archive /var/cache/apt/archives/mariadb-client-10.1_1%3a10.1.41+maria-1~bionic_amd64.deb (--unpack):
conflicting packages - not installing mariadb-client-10.1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
/var/cache/apt/archives/mariadb-server-10.1_1%3a10.1.41+maria-1~bionic_amd64.deb
/var/cache/apt/archives/mariadb-server-core-10.1_1%3a10.1.41+maria-1~bionic_amd64.deb
/var/cache/apt/archives/mariadb-client-core-10.1_1%3a10.1.41+maria-1~bionic_amd64.deb
/var/cache/apt/archives/mariadb-client-10.1_1%3a10.1.41+maria-1~bionic_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
于是我尝试手动删除mariadb,但仍然出现依赖错误:
$ sudo apt-get purge mariadb-server-core-10.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
mariadb-server : Depends: mariadb-server-10.1 (= 1:10.1.41+maria-1~bionic) but 1:10.1.40-0ubuntu0.18.04.1 is to be installed
mariadb-server-10.1 : Depends: mariadb-server-core-10.1 (>= 1:10.1.40-0ubuntu0.18.04.1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
这是我的本地机器,所以我不提醒删除东西。但我无法安装 ruby 2.3 或删除 mariadb 以安装 ruby 2.3。这里的解决方案是什么?
答案1
显然,我安装了某些版本的 MariaDB 和某些版本的 MySQL,而 Ubuntu 无法再破译这一切。也许我有旧版本的 MySQL 数据库并尝试运行较新版本的服务器。目前还不清楚服务器正在经历的混乱。但为了解决这个问题,我删除了 MySQL 的所有内容:
PKGS="mysql-server mariadb-client mariadb-server-10.0 mariadb-common"
sudo apt-get check
sudo apt remove $PKGS
sudo apt purge $PKGS
sudo apt autoremove
sudo apt-get --purge remove "mysql*"
sudo rm -rf /etc/mysql/
sudo updatedb
locate mysql
sudo rm -rf /etc/apparmor.d/abstractions/mysql
sudo rm -rf /etc/apparmor.d/cache/usr.sbin.mysqld
sudo rm -rf /etc/default/mysql
sudo rm -rf /etc/systemd/system/mysqld.service
sudo rm -rf /home/dan/.mysql_history
sudo rm -rf /var/cache/apt/archives/libmysqlclient18_1%3a10.1.41+maria-1~bionic_amd64.deb
sudo rm -rf /var/cache/apt/archives/libmysqlclient20_5.7.27-0ubuntu0.18.04.1_amd64.deb
sudo rm -rf /var/cache/apt/archives/mysql-client-5.7_5.7.27-0ubuntu0.18.04.1_amd64.deb
sudo rm -rf /var/cache/apt/archives/mysql-client-core-5.7_5.7.27-0ubuntu0.18.04.1_amd64.deb
sudo rm -rf /var/cache/apt/archives/mysql-common_1%3a10.1.41+maria-1~bionic_all.deb
sudo rm -rf /var/cache/apt/archives/mysql-server-5.7_5.7.27-0ubuntu0.18.04.1_amd64.deb
sudo rm -rf /var/cache/apt/archives/mysql-server-core-5.7_5.7.27-0ubuntu0.18.04.1_amd64.deb
sudo rm -rf /var/cache/apt/archives/mysql-server_5.7.27-0ubuntu0.18.04.1_all.deb
sudo rm -rf /var/lib/mysqld
sudo rm -rf /var/lib/systemd/deb-systemd-helper-enabled/mysql.service
sudo rm -rf /var/lib/systemd/deb-systemd-helper-enabled/mysqld.service
此时,我的系统上没有 MariaDB 或 MySQL 的踪迹。现在我可以干净地安装 MariaDB 10.1:
$ apt-cache policy software-properties-common
software-properties-common:
Installed: 0.96.24.32.11
包管理系统使用的 MariaDB 存储库公钥:
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
将 MariaDB 10.1 存储库添加到您的 Ubuntu:
sudo sh -c "echo 'deb https://mirrors.evowise.com/mariadb/repo/10.1/ubuntu '$(lsb_release -cs)' main' > /etc/apt/sources.list.d/MariaDB101.list"
然后安装 mariadb:
sudo apt-get update
sudo apt-get install mariadb-server mariadb-client
--- Mac OSX 解决方案 ---
我之前的回答是关于 Linux,特别是 Ubuntu。为了让任何遭受 mysql/mariadb 兼容性问题的人保持完整,我还提供了 OSX 解决方案:
$ brew list --versions mariadb
mariadb 10.3.12
$ brew uninstall mariadb
Uninstalling /usr/local/Cellar/mariadb/10.3.12... (658 files, 174.4MB)
$ brew doctor
$ brew cleanup # should you have some broken symlinks somewhere
$ brew info mariadb
Conflicts with:
mariadb-connector-c
mysql
mytop
percona-server
$ brew list --versions mariadb-connector-c
$ brew list --versions mysql
$ brew list --versions mytop
$ brew list --versions percona-server
$ brew search mariadb
[email protected] [email protected] [email protected]
不要安装[电子邮件受保护]然而!即使您卸载了以前的安装,brew 也会在下次安装期间保留 datadir,以确保它不会删除用户生成的数据。如果您确定此计算机上的 MySQL 数据库中没有重要数据(来自 Homebrew 安装或其他 MySQL 安装),那么可以,继续卸载 datadir 和 my.cnf 配置:
rm -rf /usr/local/var/mysql
rm -rf /usr/local/etc/my.cnf
rmdir /usr/local/etc/my.cnf.d
rm -rf /usr/local/etc/my.cnf.default
rm -rf /usr/local/etc/my.cnf.default.default
现在您可以安装旧版本:
$ brew install [email protected]
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
MySQL is configured to only allow connections from localhost by default
To connect:
mysql -uroot
[email protected] is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have [email protected] first in your PATH run:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
For compilers to find [email protected] you may need to set:
export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
For pkg-config to find [email protected] you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/share/pkgconfig"
To have launchd start [email protected] now and restart at login:
brew services start [email protected]
Or, if you don't want/need a background service you can just run:
/usr/local/opt/[email protected]/bin/mysql.server start
阅读安装的结束语!您需要将 $PATH 添加到[电子邮件受保护]到您的 .bash_profile (如果这是在 shell init 上加载的)。