Install MySQL on Ubuntu without a password prompt

How do I write a script to install MySQL server on Ubuntu?

sudo apt-get install mysql will install, but it will also ask for a password to be entered in the console.

How do I do this in a non-interactive way? That is, write a script that can provide the password?

#!/bin/bash
sudo apt-get install mysql  # To install MySQL server

# How to write script for assigning password to MySQL root user
# End

4 Answers
4

Leave a Comment