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-server_5.7.16-0ubuntu0.16.04.1_all.deb …
Unpacking mysql-server (5.7.16-0ubuntu0.16.04.1) …
Setting up mysql-server (5.7.16-0ubuntu0.16.04.1) …
root@mizzouadvantagecod:~#
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I had the same problem which prevented me from being able to access mysql all the answers to use mysql_secure_installation
after running sudo apt install mysql-server
didn’t work. Here’s what worked
sudo apt-get update && sudo apt-get install mysql-server
This time you’d be asked for a password.Hope it helps. Cheers!
Check the mysql logs: grep ‘temporary password’ /var/log/mysqld.log
try Dimitre’s answer here: https://stackoverflow.com/questions/7739645/install-mysql-on-ubuntu-without-a-password-prompt you can set the mysql root password before installation
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.
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.
Click below to sign up and get $100 of credit to try our products over 60 days!
When I was following along the Digital Ocean guide, my Ubuntu 18.04 server did not ask to set the MySQL root user password during apt-get install mysql-server. I was able to login to MySQL and manually set the password using the following commands
I then needed to run
mysql_secure_installation
using thesudo
commandThe
sudo
was not mentioned in the guide. When I ran it without sudo, I got the following error: Error: Access denied for user ‘root’@‘localhost’Hope this is helpful for others.
This comment has been deleted