Simplest Enterprise Continuous Integration Solutions

Saturday, October 8, 2011

MySQL: Community Server x86 64bit RPMs

Scenario:

Install MySQL Community Server 5.5 x86 64bit RPMs on Red Hat 5 server.



#!/bin/sh
TIME_STAMP=`date +%Y-%m-%d_%H_%M_%S`
TMPP_DIR=/tmp
MYSQL_USER=my_user
MYSQL_PASSWORD=my_password
FQDN_HOSTNAME=`hostname -f`


# make sure MySQL Community 5.5 x86 64bit RPMs existence

if [ -e "${TEMP_DIR}/MySQL-shared-5.5.25-1.rhel5.x86_64.rpm" ]; then
   /bin/chmod a+x ${TEMP_DIR}/MySQL-shared-5.5.25-1.rhel5.x86_64.rpm
else
   /bin/echo "${TEMP_DIR}/MySQL-shared-5.5.25-1.rhel5.x86_64.rpm doesn't exist" > "${MY_OUTPUT}"
   exit 1
fi
if [ -e "${TEMP_DIR}/MySQL-client-5.5.25-1.rhel5.x86_64.rpm" ]; then
   /bin/chmod a+x ${TEMP_DIR}/MySQL-client-5.5.25-1.rhel5.x86_64.rpm
else
   /bin/echo "${TEMP_DIR}/MySQL-client-5.5.25-1.rhel5.x86_64.rpm doesn't exist" > "${MY_OUTPUT}"
   exit 1
fi
if [ -e "${TEMP_DIR}/MySQL-server-5.5.25-1.rhel5.x86_64.rpm" ]; then
   /bin/chmod a+x ${TEMP_DIR}/MySQL-server-5.5.25-1.rhel5.x86_64.rpm
else
   /bin/echo "${TEMP_DIR}/MySQL-server-5.5.25-1.rhel5.x86_64.rpm" > "${MY_OUTPUT}"
   exit 1
fi
if [ -e "/var/lib/mysql" ]; then
   /bin/mv /var/lib/mysql /var/lib/mysql_${MY_TIME_STAMP_STRING}
fi
MY_OUTPUT="/tmp/mysql_rpm_install_output"
MY_MYSQL_RPMS="MySQL-shared MySQL-server MySQL-client"
MYSQL=/usr/bin/mysql
for i in `echo ${MY_MYSQL_RPMS}`
do
   /bin/rpm -Uvh --replacepkgs "${TEMP_DIR}/${i}*.rpm" > "${MY_OUTPUT}" 2>&1
   if [ "$?" != "0" ]; then
      /bin/cat "${MY_OUTPUT}"
      exit 1
   fi
done


# create MySQL user

$MYSQL -u root -e "CREATE USER '${MYSQL_USER}'@'${FQDN_HOST_NAME}' IDENTIFIED BY '${ FQDN_HOSTNAME }';" > "${MY_OUTPUT}" 2>&1
if [ "$?" != "0" ]; then
   /bin/cat "${MY_OUTPUT}"
   exit 1
fi


# grant MySQL user

$MYSQL -u root -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'${FQDN_HOSTNAME}' IDENTIFIED BY '${MYSQL_PASSWORD}';" > "${MY_OUTPUT}" 2>&1
if [ "$?" != "0" ]; then
   /bin/cat "${MY_OUTPUT}"
   exit 1
fi


# flush privileges

$MYSQL -u root -e "FLUSH PRIVILEGES;"
if [ "$?" != "0" ]; then
   /bin/cat "${MY_OUTPUT}"
   exit 1
fi


# install completed

echo "INSTALLED SUCCESSFULLY"
if [ -e "${MY_OUTPUT}" ]; then
   /bin/rm -f "${MY_OUTPUT}"
fi
exit 0

1 comment:

  1. The annual cardroom license payment for every facility shall be $1,000 for every 1xbet desk to be operated at the cardroom. The license payment shall be deposited by the commission with the Chief Financial Officer to the credit of the Pari-mutuel Wagering Trust Fund. “Authorized game” means a sport or series of games of poker or dominoes which are performed in a nonbanking manner. A person may not obtain any consideration or commission for permitting a penny-ante sport to occur in his or her dwelling. Charitable, nonprofit organizations; drawings by probability; required disclosures; illegal acts and practices; penalties. Older elementary youngsters could also be} interested in learning about playing, including their long-term chances of successful.

    ReplyDelete