1

Linux Mint 19.3

我想安装 mySQl。所以这里的步骤:

  1. sudo apt 更新
  2. sudo apt install mysql-server mysql-client
  3. mysql -V

并且它成功安装了 MySQL。

npacking mysql-server (5.7.30-0ubuntu0.18.04.1) ...
Setting up libevent-core-2.1-6:amd64 (2.1.8-stable-4build1) ...
Setting up mysql-server-core-5.7 (5.7.30-0ubuntu0.18.04.1) ...
Setting up mysql-client-core-5.7 (5.7.30-0ubuntu0.18.04.1) ...
Setting up mysql-client-5.7 (5.7.30-0ubuntu0.18.04.1) ...
Setting up mysql-client (5.7.30-0ubuntu0.18.04.1) ...
Setting up mysql-server-5.7 (5.7.30-0ubuntu0.18.04.1) ...
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
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for systemd (237-3ubuntu10.41) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)



alex@nb_linuxmint:~$ mysql -V
mysql  Ver 14.14 Distrib 5.7.30, for Linux (x86_64) using  EditLine wrapper

但问题是它没有问我关于 root db 密码的问题。因此,当我尝试像这样连接到数据库时:

mysql -u root -p
Enter password: 

我不知道密码。

4

1 回答 1

1

您应该在安装 mysql_server 后运行 mysql_secure 安装。

https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-16-04

于 2020-07-26T10:21:41.573 回答