No password is asked when installing mysql-server

January 15, 2017 301 views
LAMP Stack MySQL Ubuntu 16.04

No password is asked when installing mysql-server.
this is the output I have from the terminal :

root@mizzouadvantagecod:~# sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree

Reading state information... Done
The following NEW packages will be installed:
mysql-server
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/10.1 kB of archives.
After this operation, 106 kB of additional disk space will be used.
Selecting previously unselected package mysql-server.
(Reading database ... 85555 files and directories currently installed.)
Preparing to unpack .../mysql-server5.7.16-0ubuntu0.16.04.1all.deb ...
Unpacking mysql-server (5.7.16-0ubuntu0.16.04.1) ...
Setting up mysql-server (5.7.16-0ubuntu0.16.04.1) ...
root@mizzouadvantagecod:~#

2 Answers

It's now fixed:

Remove all files related to MySQL

sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean

Then upgrade my distribution

sudo apt-get dist-upgrade

Then install MySQL

sudo apt-get install mysql-server
That's all.

@devmnrj8d73c1ef4c13c847f2a

As a general note, depending on the OS and the decision of the package manager, a password may not be required during package installation.

To remedy that, and something you should run after installing MySQL or MariaDB anyway:

mysql_secure_installation

Simply follow the on-screen prompts and it'll handle setting the root password (or changing it) as well as removing un-needed items from the core.

Have another answer? Share your knowledge.