I want to install a mysql-server on a Raspberry Pi (Debian) using a SSH-connection and a bash script, which contains the installation commands. The point is, that the installation needs to be done automatically using the script. I don`t want any user interaction or graphical prompts in the SSH window.
That's why I'm using the following code, to setup a mysql-server but prevent any graphical feedback:
sudo DEBIAN_PRIORITY=critical apt-get install -y -q mysql-server php5-mysql
So far it's working well and the installation runs without any prompts, etc. But when I try to change the root password of the MySQL server after the installation, I always get the response:
$ mysql -u root ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
I expected that the silent installation uses the standard user "root" and an empty password, but I also tried a lot of other possible options. I also tried other commands like:
$ mysql -u "root" -p "" $ mysql --user="root" --password=""
$ mysqladmin -u root password "" mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: NO)'
but unfortunately without any success.
Does anybody know a way to silently and non-graphical install a mysql-server in a script with configuring the root password in the script or change it after setting up everything?