In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1 minute to complete the introduction of MySQL5.7 installation and deployment
Part1: write at the front
MYSQL5.7.15 is the latest community version of the official website of mysql as of the date of writing of this article. Many functional optimizations of mysql5.7 can be described as exciting and troublesome to install. It doesn't matter, follow this article, I will take you 1 minute to complete the installation and deployment of MySQL5.7.15 database.
Part2: just installing it is enough?
No, of course not. Many features of MySQL5.7 have been updated, so we can't repeat them one by one. Therefore, let's first interpret some of the new features of MySQL5.7 from my.cnf, which is most relevant to this article.
Earlier I wrote about new feature parameters for MySQL5.6, such as:
Innodb_buffer_pool_dump_at_shutdown=1
Innodb_buffer_pool_load_at_startup=1
Turn on these two parameters to reload the hot data when the database is restarted.
Only normal library shutdown will lead to dump hot data blocks, downtime and kill-9 will not.
More 5.6 installation can be moved:
Http://suifu.blog.51cto.com/9167728/1846671
In 5.7A new system parameter: innodb_buffer_pool_dump_pct, with a default value of 25
Allow DBA to control the percentage of recently used pages per buffer pool to export to slow down the excessive disk footprint of all pages in the exported innodb buffer pool. If 100 pages are cached in innodb buffer pool, the most recently used 25 pages will be exported, with a maximum of 100, which means all exports, as shown in the following figure:
Note: in MariaDB10.1, this parameter is also provided, but the default value is 100
Adjust innodb_buffer_pool_size online without restarting the mysql process
In MySQL5.6/MariaDB version 10.1, adjusting this parameter must restart the MySQL process to take effect, while in the mysql5.7 version, it can be set directly and dynamically, which is very convenient.
This feature is used in scenarios such as:
1. The machine added new memory. DBA forgot to increase this parameter.
two。 When the job was handed over, the new DBA found that the previous DBA set the parameter improperly.
The following test is carried out in my machine, changing 512m memory to 256m, as shown in the following figure:
It is important to note that during the adjustment of the buffer_pool, the user's request will be blocked until the adjustment is complete, so do not adjust during the peak period.
Actual combat
Part1: the whole process is divided into three steps
Download the binary version of the mysql5.7.15 installation package (mysql-5.7.15-linux-glibc2.5-x86_64.tar.gz) to the / root directory on the 1.mysql official website
two。 Execute the mysql_auto_install.sh script described below
3. Enter the password you set to log in to the database
Part2: automation script
[root@HE2 ~] # cat mysql_auto_install.sh# binary automatic installation database script root password MANAGER put the script and installation package in the / root directory # database directory / usr/local/mysql# data directory / data/mysql# # slow log directory / data/slowlog# port number defaults to 3306. Other parameters can be modified as needed # # authorizaRrheleiport 126.compositeBinram 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 1ficlearecho "=" echo "A tool to auto-compile & install MySQL 5.7.15 on Redhat/CentOS Linux" echo "=" cur_dir=$ (pwd) # set mysqlroot password echo "=" mysqlrootpwd= "MANAGER" echo-e "Please input the root password of mysql:" read-p "(Default password: MANAGER):" mysqlrootpwd if ["$mysqlrootpwd" = ""] Then mysqlrootpwd= "MANAGER" fi echo "=" echo "MySQL root password:$mysqlrootpwd" echo "=" # which MySQL Version do you want to install?echo "= =" isinstallmysql57= "n" echo "Install MySQL 5.7.15 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.15 "isinstallmysql57=" y " *) echo "INPUT error You will exit install MySQL 5.7.15 "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 = = InstallMySQL 5.7.15 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.conf} # Install MySQLfunction InstallMySQL57 () Then mv / etc/my.cnf / etc/ my.cnf.`date +% Y% m% d% H% M% S`.bakfiecho "= = MySQL 5.7.15 installing. = "# mysql directory configurationtar xvf / root/mysql-5.7.15-linux-glibc2.5-x86_64.tar.gzmv / root/mysql-5.7.15-linux-glibc2.5-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 addr" | 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
Part5: log in & enjoy it
1. First source the environment variable file to make it effective
[root@HE2 ~] source / etc/profile
two。 Enter the user name and password (default is MANAGER) to log in to the database
At this point, the MySQL5.7.15 installation is complete
-- Summary.
MySQL5.7 has many new features that we are excited and looking forward to. Limited to the length of the article, this is just the tip of the iceberg. As the author's level is limited and the writing time is very short, it is inevitable that there will be some errors or inaccuracies in the article. I urge readers to criticize and correct them.
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.