0

I'm trying to make a PHP script that automates installation of linux web servers.

I'm currently stuck at this part:

When I'm installing the MySQL server it will open its own screen and it will ask me for the root password.

I know how to save the password in a variable but how can I make that MySQL screen use that variable?

This is what I have so far:

<?php
$_fp = fopen("php://stdin", "r"); 
echo 'Input mysql root password: '; 
$rootpswd = trim(fgets(STDIN)); 
Marco
  • 7,007
  • 2
  • 19
  • 49
Ivo
  • 73
  • 1
  • 9

1 Answers1

0

If you are installing with apt-get , try adding the -y parameter. Then the root password should be empty. Errata: /etc/my.cnf only tells the mysql tool which default password to use.

Laurent P
  • 36
  • 2