Question

I am writing the shell script to automatically install all the required packages for PHP site, I have written the script to automate the installation. I am using below script to install the mysql without prompt for password:

#!/bin/sh
LOGFILEPATH=/home/philtracker/logs/logs.log
echo "Executing Installation script">>$LOGFILEPATH
for i in apache2 php5 libapache2-mod-php5  php5-json mysql-server apache2-mod-auth-mysql     php5-mysql
    do
        sudo apt-get -y install $i
        if [ $? -ne 0 ] ; then
            echo "$i: installation failed for $i">>$LOGFILEPATH 2>&1
        else
            echo "$i: Installation successful for $i">>$LOGFILEPATH 2>&1
    fi
done

The above script installing the all packages successfully, But as I have automated the installation for MYSQL I don't have a password to login to mysql. Is there any default password set by MySQL ?

Was it helpful?

Solution

I believe it's root/root...or it's blank!

You can also directly update the password:

UPDATE
   mysql.user
SET
   Password=PASSWORD('MyNewPass')
WHERE
   User='root'; FLUSH PRIVILEGES;

http://www.thegeekstuff.com/2009/01/15-practical-usages-of-mysqladmin-command-for-administering-mysql-server/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top