MySQL(5.7) don't prompt me about root db password

103 Views Asked by At

Linux Mint 19.3

I want to install mySQl. So here steps:

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

And it's success install 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

But the problem is it don't ask me about root db password. So as result when I try to connect to db like this:

mysql -u root -p
Enter password: 

I don't know the password.

1

There are 1 best solutions below

2
On

You should run the mysql_secure installation after installing mysql_server.

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