In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Introduction # Database directory / usr/local/mysql# data directory / data/mysql# slow log directory / data/slowlog# port number default 3306 other parameters can be modified as needed # installation Script #! / bin/bashcd / usr/local/src/if [!-f mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz] Thenwget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.21-linux-glibc2.12-x86_64.tar.gzfiyum install-y autoconf automake imake libxml2-devel expat-devel cmake gcc gcc-c++ libaio libaio-devel bzr bison libtool ncurses-devel gcc gcc-c++ # Check if user is rootif [$(id-u)! = "0"] Then echo "Error: You must be root to run this script, please use root to install" exit 1ficlearcd / usr/local/srcif [!-f jemalloc-5.0.1.tar.bz2] Thenyum install bzip2-ywget https://github.com/jemalloc/jemalloc/releases/download/5.0.1/jemalloc-5.0.1.tar.bz2tar-xjvf jemalloc-5.0.1.tar.bz2cd jemalloc-5.0.1/./configure-prefix=/usr/local/jemalloc-libdir=/usr/local/libmake & & make installecho / usr/local/lib > > / etc/ld.so.confldconfigficp / usr/local/lib/libjemalloc.so / usr/libecho "= =" echo "A tool to auto-compile & install MySQL 5.7.21 on Redhat/CentOS Linux" echo "=" cur_dir=$ (pwd) # set mysqlroot password echo "=" mysqlrootpwd= "123456" echo-e "Please input the root password of mysql:" read-p "(Default password: 123456):" mysqlrootpwd if ["$mysqlrootpwd" = ""] Then mysqlrootpwd= "123456" fi echo = = "echo" MySQL root password:$mysqlrootpwd "echo" = "# which MySQL Version do you want to install?echo" = = "isinstallmysql57=" n "echo" Install MySQL 5.7.21 Please input y "read-p" (Please input y, n): "isinstallmysql57 case" $isinstallmysql57 "in y | Y | Yes | YES | yes | yES | yEs | YeS | yeS) echo" You will install MySQL 5.7.21 "isinstallmysql57=" y "y" *) echo "INPUT error You will exit install MySQL 5.7.21 "isinstallmysql57=" n "exit esac get_char () {SAVEDSTTY= `stty-g`stty-echo stty cbreak # dd if=/dev/tty bs=1 count=1 2 > / dev/null stty-raw stty echo stty $SAVEDSTTY} echo"echo" Press any key to start...or Press Ctrl+c to cancel "char= `get _ char` # Initialize the installation related content.function InitInstall () {cat / etc/issue Uname-a MemTotal= `free-m | grep Mem | awk'{print $2} '`echo-e "\ n Memory is: ${MemTotal} MB" # Set timezone # rm-rf / etc/localtime # ln-s / usr/share/zoneinfo/Asia/Shanghai / etc/localtime # Delete Old Mysql program rpm-qa | grep mysql rpm-e mysql # Disable SeLinux if [- s / etc/selinux/config] Then sed-I's echo echo = = InstallMySQL 5.7.21 echo = "cd $cur_dir#Backup old my.cnf#rm-f / etc/my.cnfif [- s / etc/my.cnf] # Installation of depend on and optimization options.function InstallDependsAndOpt () {cd $cur_dircat > > / etc/security/limits.conf / etc/sysctl.confsysctl-p} # Install MySQLfunction InstallMySQL57 () Then mv / etc/my.cnf / etc/ my.cnf.`date +% Y% m% d% H% M% S`.bakfiecho "= = MySQL 5.7.21 installing. = "# mysql directory configurationcd / usr/local/srctar xvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gzmv mysql-5.7.21-linux-glibc2.12-x86_64 / usr/local/mysqlgroupadd mysql- g 512useradd-u 512-g mysql- s / sbin/nologin-d / home/mysql mysqlmkdir-p / data/mysqlmkdir-p / data/slowlogchown-R mysql:mysql / data/mysqlchown-R mysql:mysql / usr/local/mysqlchown-R mysql:mysql / Data/slowlog#edit / etc/my.cnfSERVERID= `ifconfig eth0 | grep "inet" | awk'{print $2}'| awk-F. '{print $3 $4}' `cat > > / etc/my.cnf / etc/ld.so.conf.d/mysql-x86_64.conf / etc/profile / dev/nullCheckInstall 2 > & 1 | tee-a / root/mysql-install.log backup mysqldump-uroot-p123456-B ultrax-- single-transaction-- master-data=2 > ultrax.sql-A full backup-B backup library (table structure and data)-- single-transaction prevent locking data Consistency ensures that during this session (dump) You will not see data that has been submitted by other sessions. -- master-data=2 comment record copy information = 1 record change master to statement View SQLegrep-v "# |\ * |-- | ^ $" ultrax.sql restore mysql-uroot-p123456 < / root/ultrax.sql change password [mysqld] skip-grant-tables./mysqladmin-uroot-p passwordupdate user set password=password ('root') where user='root';update user set authentication_string=PASSWORD (' 123456') where user='root'
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.