I have this following script which works fine on ubuntu for starting and creating a new table for MySQL database:
echo "CREATE DATABASE database_name" | mysql -u root -p
After this command is executed MySQL asks for password.
The only problem is that I want to do this on vagrant provision bash script, so I have to automate the process of entering the password. I basically have to give a single line of input to the MySQL program like this:
Enter password: password_goes_here
How do I combine the process of entering the database creation command and the password as text to the program?
CREATE DATABASE database_name
– The amateur programmer Feb 25 '16 at 07:31mysql -u root -p
command. As this command is executed from vagrant provision script there is no way to provide the password manually. I don't know though if the password could be provided int themysql
command arguments though. – The amateur programmer Feb 25 '16 at 07:37mysql -u root --password=mypassword_here
– The amateur programmer Feb 25 '16 at 07:40