我正在尝试在 Debian 10 上安装 MySql 并不断收到错误消息。我究竟做错了什么?

I am trying to install MySql on Debian 10 and keep getting an error. What am I doing wrong?

我一直在尝试在全新安装的 Debian 10 上安装 MySql 或 MariaDb。应该是一个简单的过程,(sudo apt-get install mariadb-server mariadb-client) 但我不断收到此错误:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
mariadb-client : Depends: mariadb-client-10.4 (>= 
1:10.4.7+maria~buster) but it is not going to be installed
mariadb-server : Depends: mariadb-server-10.4 (>= 
1:10.4.7+maria~buster) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

这是全新安装。 PHP 和 Apache2 已安装。我已经尝试使用第一个 MySql 多次,然后当它不起作用时,我尝试使用 MariaDb,但仍然遇到相同的错误。不知道还能做什么。我尝试了谷歌搜索,唯一关闭的建议是确保它没有安装,甚至清除任何以前的安装。我试过了,还是不行。

在处理了大约 4 个小时之后,我终于弄明白了。在安装 Debian 时,我看到了一些关于要安装的软件的选项。其中一个选项是安装 Web 服务器软件。所以,我选择了这样做。那是个错误。首先,您不会通过选择该选项获得所有需要的 php 模块。其次,该选择确实安装了 MySql 所需的一些内容,但不足以实际工作。 所以,最后,对于遇到此问题的任何其他人,这就是我解决它的方法。 首先,运行 命令:

    sudo service mysql stop
    sudo apt-get --purge remove "mysql*"
    sudo rm -rf /etc/mysql/ 

然后,确保在 运行ning

之前一切都已完成
   sudo updatedb
   locate mysql

您仍然会看到一些东西,但请确保您看不到 my.cnf 文件。那是我案子的罪魁祸首。如果您确实看到它,请将其也删除。 现在重新安装 MySql,你应该不会有任何问题。如果您还安装了 phpMyAdmin,您仍然需要 运行 再执行一个命令来获取所需的扩展。

    sudo apt install php-imagick php-phpseclib php-php-gettext php7.3-common 
    php7.3-gd php7.3-imap php7.3-json php7.3-curl php7.3-zip php7.3-xml 
    php7.3-mbstring php7.3-bz2 php7.3-intl php7.3-gmp