Mysql automated installation script (ubuntuandcentos64) CentOS6CentOSUbuntu
Ubuntu Mysql automated installation script
#/Bin/bash
Function hasDpkg
{
R = 'dpkg-l | grep "$1 "'
If [-n "$ r"]
Then
H = 'dpkg-l | grep "ii $1 "'
If [-n "$ h"]
Then
Return 1
Else
Return 0
Fi
Else
Return 0
Fi
}
Mysql = mysql-server-5.5"
HasDpkg $ mysql
R = $?
If [$ r-eq 1]
Then
:
# Echo "$ mysql was installed"
Else
Echo "$ mysql was not installed"
Echo mysql-server/root_password password adv | sudo debconf-set-selections
Echo mysql-server/root_password_again password adv | sudo debconf-set-selections // set the root user and its password
Apt-get install $ mysql
Fi
CentOS64 mysql automated installation script
#/Bin/bash
Function hasinstall
{
R = $ (rpm-qa "$1 ")
If [$ r]
Then
Return 1
Else
Return 0
Fi
}
Mysql = "mysql-server"
Hasinstall $ mysql
R = $?
If [$ r-eq 1]
Then
:
Echo "$ mysql was installed"
Else
Echo "$ mysql was not installed"
Yum install mysql-server mysql-devel
Service mysqld start
Fi
# Add User to Mysql database
Echo "INFORM: Enter database root password"
Mysql-uroot-p-hlocalhost
Adduser. SQL script
Insert ignore into mysql. user (Host, User, Password)
Values ('localhost', 'loadserver', 'adv ');
Flush privileges;
Grant all privileges on *. * to loadserver @ localhost identified by 'adv ';
Flush privileges;