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

The latest version of MySQL MySQL5.7.11 batch automated one-button installation

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

Share

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

Used to like the source code to install MySQL, always feel that the source code is a high-end thing, but the source code also takes time, especially when make, if the disk and cpu are poor, the time is very long, especially slow to install mysql on the virtual machine.

Now that the business has developed and started to be deployed on the cloud, you need to install mysql frequently, and sometimes deploy many at a time. If you still install the source code one by one, the efficiency will be relatively low, so you are prepared to use faster and more efficient binaries to automatically install mysql with one click.

Download address of 1meme MySQL binary installation package

Download address: http://download.csdn.net/detail/mchdba/9488918, including

1) one-click automatic installation script: auto_install_mysql5.7.sh

2) Mysql parameter file my.cnf

3) Mysql5.7 binary installation package, which has a download address connection in the readme_mysql5.7_down_address.txt file, which is many times faster than the mysql official website.

PS: after downloading, put all the software in the script in the same directory, such as / soft.

Blog source address: http://blog.csdn.net/mchdba/article/details/51138063, refuse to reprint.

2. Initialize linux server scripts automatically

Execute bash-x init_linux.sh to initialize the Linux server automatically. The automatic installation script init_linux.sh is as follows, and the download address is http://download.csdn.NET/detail/mchdba/9488929:

# 1 instal jdk, add tomcat user

Sh init_jdk.sh

Useradd tomcat

Mkdir-p / usr/local/app/

Chown-R tomcat.tomcat / usr/local/app

# 2 # vim / etc/sudoers

Echo "tomcat ALL= (ALL) ALL" > > / etc/sudoers

# 3 set limits.conf

Echo "* soft nofile 65536" > > / etc/security/limits.conf

Echo "* hard nofile 65536" > > / etc/security/limits.conf

Ulimit-a

# 4 kernel optimization

Grep "net.ipv4.tcp_keepalive_time = 30" / etc/sysctl.conf

If [$?! = 0]

Then

Cat / etc/sysctl.conf

Net.ipv4.tcp_max_tw_buckets = 6000

Net.ipv4.ip_local_port_range = 1024 65000

Net.ipv4.tcp_tw_recycle = 0

Net.ipv4.tcp_tw_reuse = 1

Net.core.somaxconn = 262144

Net.core.netdev_max_backlog = 262144

Net.ipv4.tcp_max_orphans = 262144

Net.ipv4.tcp_max_syn_backlog = 262144

Net.ipv4.tcp_synack_retries = 2

Net.ipv4.tcp_syn_retries = 1

Net.ipv4.tcp_fin_timeout = 1

Net.ipv4.tcp_keepalive_time = 30

Net.ipv4.tcp_keepalive_probes = 6

Net.ipv4.tcp_keepalive_intvl = 5

Net.ipv4.tcp_timestamps = 0

EOF

Sed-I 's/net.bridge.bridge-nf-call-ip6tables = 0/#net.bridge.bridge-nf-call-ip6tables = 0max g' / etc/sysctl.conf

Sed-I 's/net.bridge.bridge-nf-call-iptables = 0/#net.bridge.bridge-nf-call-iptables = 0max g' / etc/sysctl.conf

Sed-I 's/net.bridge.bridge-nf-call-arptables = 0/#net.bridge.bridge-nf-call-arptables = 0max g' / etc/sysctl.conf

Fi

Sysctl-p

# 5 selinux disabled

Sed-I's etc/sysconfig/selinux SelinuxplenforcingAccording to SELINUXAfter

Sed-I's peg _ id _

# 6 stop some services

Service iptables stop

Sh stopservice.sh

# 7 see the version

# less / etc/issue

# 8 set 90-nproc

Sed-I's Universe * soft nproc 1024 Universe * soft nproc 1024 Universe / etc/security/limits.d/90-nproc.conf

Sed-I 's/root soft nproc unlimited/* soft nproc unlimited/g' / etc/security/limits.d/90-nproc.conf

# 9 system basic lib package install

Yum install gcc gcc-c++ ncurses-devel.x86_64 cmake.x86_64 libaio.x86_64 bison.x86_64 gcc-c++.x86_64 bind-utils wget curl curl-devel perl openssh-clients setuptool sysstat-y

Yum search rz-y

Yum install-y lrzsz.x86_64

# 10 set shanghai time

Cp-f / usr/share/zoneinfo/Asia/Shanghai / etc/localtime

Hwclock

# 11 restart the linux server

Shutdown-r now

3, automatic installation script

Execute the script bash-x auto_install_mysql5.7.sh to start the one-click installation. The automated installation script is as follows:

# install the basie lib

Yum install cmake-y

Groupadd mysql

Useradd-g mysql mysql

Autoreconf-force-install

Libtoolize-automake-force

Automake-force-add-missing

Yum install-y libtoolize

Yum install gcc gcc-c++-y

Yum install-y ncurses-devel.x86_64

Yum install-y cmake.x86_64

Yum install-y libaio.x86_64

Yum install-y bison.x86_64

Yum install-y gcc-c++.x86_64

Yum install make-y

# add mysql account,create the basic directory

Mkdir-p / data/mysql/data

Cd / data/mysql/data

Chown-R mysql.mysql / data

Chown-R mysql.mysql / usr/local/mysql5711

Mkdir-p / data/mysql/binlog/

Chown-R mysql.mysql / data/mysql/binlog/

Cd / usr/local/mysql5711/

# init databases

Rm-rf / data/mysql/data/*

Cp my.cnf / usr/local/mysql5711/my.cnf

Time bin/mysqld-defaults-file=/usr/local/mysql5711/my.cnf-initialize-user=mysql

# set the auto start on linux server started

Cp support-files/mysql.server / etc/init.d/mysql

Chmod 700 / etc/init.d/mysql

Echo "export PATH=$PATH:/usr/local/mysql5711/bin" > > / etc/profile

Source / etc/profile

Chkconfig-add mysql

# do a soft link to start mysql

Cd / usr/local/

Ln-s / usr/local/mysql5711 mysql

# remove default my.cnf

Mv / etc/my.cnf / tmp/

# set the default password

/ usr/local/mysql/bin/mysqld_safe-skip-grant-tables-skip-networking &

/ usr/local/mysql/bin/mysql-uroot-- password=''-- socket='/usr/local/mysql/mysql.sock'-e "update mysql.user set authentication_string=password ('dns_yuerld') where user='root' and Host =' localhost'; flush privileges;"

/ usr/local/mysql/bin/mysql-uroot-- password='dns_yuerld'-- socket='/usr/local/mysql/mysql.sock'-e "set PASSWORD=PASSWORD ('dns_yuerld'); create database t; create table T1 select 1 as a; select * from T1;"

If mysqld_safe fails to start, you can add skip-grant-tables=1 directly to the mysqld tab of my.cnf, and then restart mysql to log in without a password.

# restart the mysql server

Service mysql restart

# check the test

/ usr/local/mysql/bin/mysql-uroot-password='dns_yuerld'-socket='/usr/local/mysql/mysql.sock'-e "select * from T1;"

4. Install many mysql instances in batch

Scp the script and installation software to N servers, then ssh ip the address "sh / soft/init_linux.sh; sh / soft/install_mysql.sh;" and install it with a background batch process.

5,why? Use binary installation instead of source installation

The main reason is that it takes too much time to install the source code in the make link, and it takes a long time to install mysql with the source code, while the binary installation eliminates the steps of configure, make and make install, which greatly reduces the installation time and improves the efficiency. The installation of mysql on a single machine does not feel big. If thousands of sets are installed at once, the gap is heaven and earth.

In addition: during the installation process to check the console information in real time, if there are strange error messages, to timely troubleshooting.

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