Last active
September 22, 2020 00:04
-
-
Save mansurali901/ceccec6319c739414fd8f213e6d2489c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script Mysql 5.7 from RPM Builder | |
# Author Mansur Ul Hasan | |
# [email protected] | |
Prepass () { | |
echo "Preparing Environement ....." | |
yum groupinstall "Development Tools" | |
yum install ncurses-dev libaio perl-DBI | |
echo "Adding User...." | |
groupadd mysql | |
useradd -r -g mysql -s /bin/false mysql | |
echo "Download Source RPMs" | |
mkdir /usr/local/mysql-rpms | |
cd /usr/local/mysql-rpms | |
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.21-1.el6.x86_64.rpm-bundle.tar | |
tar -xvf mysql-5.7.21-1.el6.x86_64.rpm-bundle.tar | |
rpm -i mysql-community-common-5.7.21-1.el6.x86_64.rpm | |
rpm -i mysql-community-libs-5.7.21-1.el6.x86_64.rpm | |
rpm -i mysql-community-devel-5.7.21-1.el6.x86_64.rpm | |
rpm -i mysql-community-libs-compat-5.7.21-1.el6.x86_64.rpm | |
rpm -i mysql-community-embedded-5.7.21-1.el6.x86_64.rpm | |
rpm -i mysql-community-embedded-devel-5.7.21-1.el6.x86_64.rpm | |
rpm -i mysql-community-client-5.7.21-1.el6.x86_64.rpm | |
rpm -i mysql-community-server-5.7.21-1.el6.x86_64.rpm | |
} | |
SetupFunc () { | |
mysqld --initialize --basedir=/var/lib/mysql | |
/etc/init.d/mysqld stop | |
echo "We are going to start mysql in safe mode to reset your mysql root password..... | |
Please issue below commands in order to reset your root access | |
connect to mysql cli | |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
mysql | |
flush privileges; | |
SET PASSWORD FOR root@'localhost' = PASSWORD('yourrootpassword'); | |
flush privileges; | |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
After applying above commands start your mysql in normal mode | |
" | |
} | |
MysqlSafe () { | |
mysqld_safe --skip-grant-tables & | |
} | |
# Main Function | |
Prepass | |
# Setup Function | |
SetupFunc | |
# Safe Mode | |
MysqlSafe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment