首页 > 解决方案 > 无法在 Linux mint 19 中安装 mysql

问题描述

我是 Linux 初学者。昨天,我尝试在我的 Linux mint 笔记本电脑上安装 MySQL。我已成功安装 Apache,但在尝试安装 MySQL 时出现以下错误。

Setting up mysql-server-5.7 (5.7.25-0ubuntu0.18.04.2) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
dpkg: error processing package mysql-server-5.7 (--configure):
 installed mysql-server-5.7 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          Processing triggers for systemd (237-3ubuntu10.17) ...
Processing triggers for ureadahead (0.100.0-20) ...
Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

sudo apt-get purge mysql*

sudo apt-get 自动删除

sudo apt-get 自动清理

sudo apt-get dist-upgrade

我试图再次从网上找到一种方法,但没有任何效果,因此我无法入睡..:(

标签: mysqllinux-mint

解决方案


我在 Mint 上安装了 MySQL 无数次,但我最近开始遇到同样的问题 - 完全出乎意料。

试试这里的步骤:

https://vitux.com/how-to-install-and-configure-mysql-in-ubuntu-18-04-lts/

sudo apt-get update

sudo apt-get install mysql-server

sudo mysql_secure_installation

您的 MySQL 服务器将有几个是和否选项。选择适合你的,然后使用sudo mysql 登录,而不仅仅是mysql

sudo mysql -uroot -p

提示将从您的 linux 登录用户变为mysql>

对于自动创建的用户列表:

mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;

更改 root 用户的身份验证方法,并根据需要分配新密码:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

现在您将能够从 MySQL 工作台访问 MySQL 服务器。老实说,我建议使用它,因为它使您的生活更轻松。


推荐阅读