自動インストールなどでMySQLのrootパスワード入力を求められないために
シェル作成
説明上、root_password パスワードは「root」にしてある。適宜変更して使う。
$ vi mysql-install.sh
mysql-install.shの編集
#!/usr/bin/env bash echo "mysql-server-5.5 mysql-server/root_password password root" | debconf-set-selections echo "mysql-server-5.5 mysql-server/root_password_again password root" | debconf-set-selections aptitude -y install mysql-server
実行
$ chmod 755 mysql-install.sh $ sudo ./mysql-install.sh
確認
vagrant@vagrant-ubuntu-trusty-64:~$ mysql -u root -p Enter password: //rootと入力 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 37 Server version: 5.5.41-0ubuntu0.14.04.1 (Ubuntu) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>