Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
deploy mysql 5.7.7-labs-json on aliyun ECS el6
#!/bin/bash
tar zxvf mysql-5.7.7-labs-json-linux-el6-x86_64.tar.gz
path=`pwd`
root_path=$path/mysql-5.7.7-labs-json-linux-el6-x86_64
mkdir /opt/mysql
mkdir /opt/mysql/mysql
mkdir /opt/mysql/mysql/data
useradd mysql
usermod -a -G root mysql
chown -R mysql:mysql $root_path
chown -R mysql:mysql /opt/mysql
mkdir /var/run/mysqld
chown -R mysql:mysql /var/run/mysqld
ln -s $root_path/lib /var/lib/mysql
ln -s $root_path /usr/local/mysql
ln -s $root_path/bin/mysql /usr/local/bin/mysql
echo "installing environment"
$root_path/bin/mysql_install_db --datadir=/opt/mysql/mysql/data
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
echo "done"
echo "Starting mysql process..."
$root_path/bin/mysqld --user=mysql --datadir=/opt/mysql/mysql/data --basedir=$root_path 0<&- &>/dev/null &
while : ; do
res=`netstat -tanp | grep 3306`
if [ $? -eq 1 ] ;then
sleep 1
else
echo "mysqld process is up"
break
fi
done
echo "done"
echo "initiating mysql's root default password..."
$root_path/bin/mysql_secure_installation
echo "done"
echo "success!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment