Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

1 minute installation and deployment MySQL5.6 details

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following content mainly brings you a detailed explanation of 1-minute installation and deployment of MySQL5.6. The knowledge mentioned here, which is slightly different from books, is summed up by professional and technical personnel in the process of contact with users, and has a certain value of experience sharing. I hope to bring help to the majority of readers.

1 minute to complete the introduction of MySQL5.6 installation and deployment

Part1: write at the front

Automatic operation and maintenance is a technology that DBA should master, in which automatic installation of database is a basic skill. The installation script in this article has passed the test, and there is no problem as a production repository. In view of the different requirements of storage planning for each company, you can modify the script as needed.

Due to the time-consuming and time-consuming installation of the source code, the customizability of the rpm package is poor, and the production library generally uses the binary installation package. The installation package of this article is a binary installation file. This article uses mysql-5.6.25-linux-glibc2.5-x86_64.tar.gz. If the version is different, replace the mysql installation package name after the tar command on lines 109,110.

Part2: introduction to new features

This script enables 5.6 new features by default

Innodb_buffer_pool_dump_at_shutdown=1 it dump is not data, it is Id number.

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.

Some parameters are modified as needed, such as innodb_buffer_pool_size. The 512m given in this article is generally 50% of memory, 80% of memory.

Let's take a look at the details of the script.

Actual combat

Part1: automation script

[root@HE3 ~] # cat mysql_auto_install.sh

# binary automatic installation database script root password MANAGER put the script and installation package in / root directory # database directory / usr/local/mysql# data directory / data/mysql# log directory / log / mysql# port number defaults 3306. Other parameters can be modified as needed. # # authorizationrrheleif126.compositesbinqqbashPATHandBINRURBINGUBINRUBING / opt/sbin:~/binexport PATH# 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.6.25 on Redhat/CentOS Linux" echo "=" cur_dir=$ (pwd) # set mysqlroot passwordecho "=" mysqlrootpwd= "MANAGER" echo-e "Please input the root password of mysql:" read-p "(Default password: MANAGER):" mysqlrootpwdif ["$mysqlrootpwd" = ""] Thenmysqlrootpwd= "MANAGER" fiecho = = "echo" MySQL root password:$mysqlrootpwd "echo" = "# which MySQL Version do you want to install?echo" = = "isinstallmysql56=" n "echo" Install MySQL 5.6.25 Please input y "read-p" (Please input y, n): "isinstallmysql56case" $isinstallmysql56 "iny | Y | Yes | yes | yES | yEs | YeS | yeS) echo" You will install MySQL 5.6.25 "isinstallmysql56=" y " *) echo "INPUT error You will exit install MySQL 5.6.25 "isinstallmysql56=" n "exitesacget_char () {SAVEDSTTY= `stty-g`stty-echostty cbreak#dd if=/dev/tty bs=1 count=1 2 > / dev/nullstty-rawstty echostty $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/issueuname-aMemTotal= `free-m | 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 programrpm-qa | grep mysqlrpm-e mysql#yum-y remove mysql-server mysql mysql-libs#yum-y remove php-mysql#yum-y install yum-fastestmirror#yum-y update#Disable SeLinuxif [- s / etc/selinux/config] Thensed-I's echo echo = = InstallMySQL 5.6.22 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 InstallMySQL56 () Then mv / etc/my.cnf / etc/ my.cnf.`date +% Y% m% d% H% M% S`.bakfi # mysql directory configurationgroupadd mysql- g 512useradd-u 512-g mysql- s / sbin/nologin-d / home/mysql mysqltar xvf / root/mysql-5.6.25-linux-glibc2.5-x86_64.tar.gzmv / root/mysql-5.6.25-linux-glibc2.5-x86_64 / usr/local/mysqlmkdir-p / data/mysqlmkdir-p / log / mysqlchown-R mysql:mysql / data/mysqlchown-R mysql:mysql / usr/local/mysqlchown-R mysql:mysql / log#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 & 1 | tee-a / root/mysql-install.logInstallMySQL56 2 > & 1 | tee-a / root/mysql-install.logCheckInstall 2 > & 1 | tee-a / root/mysql-install.log

Part2: installation

After downloading the installation package, put the script and installation files in the / root directory, and execute the above script (if it is not version 5.6.25, you need to modify the version number of the script 132,133)

[root@HE3 ~] # sh-x mysql_auto_install.sh

If you install for the first time, please execute source / etc/profile again

[root@HE3 ~] # source / etc/profile

Verification

After executing the script, enter the username and password (default MANAGER) and log in to the database successfully.

At this point, the MySQL5.6 installation is complete.

For the above detailed explanation of 1-minute installation and deployment of MySQL5.6, if you have more information, you can continue to pay attention to the innovation of our industry. If you need professional answers, you can contact the pre-sales and after-sales on the official website. I hope this article can bring you some knowledge updates.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report