Automated tumysql installation script #/bin/bashfunctionhasDpkg {r = 'dpkg-l | grep "$1" 'if [-n "$ r"] then & nb
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
CentOS 64 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;
MySQL authoritative guide (original book version 2nd) Clear Chinese scanning version PDF http://www.linuxidc.com/Linux/2014-03/98821.htm
Install MySQL 5.6 script http://www.linuxidc.com/Linux/2014-04/99991.htm
MySQL source installation http://www.linuxidc.com/Linux/2014-04/100758.htm
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2
For more information about CentOS, see the CentOS topic page http://www.linuxidc.com/topicnews.aspx? Tid = 14
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2014-05/101452.htm