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

Mysql5.6.24 (binary) automatic installation script under Linux

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

Share

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

This article shares the script code of mysql5.6.24 automatic installation under Linux environment for your reference. The details are as follows.

Description:

First, this script is for testing only. If you want to use it in the formal environment, you need to change some parameters of the script.

2. Before using this script, you need to make sure that the linux environment can be downloaded online. If you cannot connect to the Internet, you need to upload the downloaded mysql binary package to the / data directory in linux.

3. To use the script, you need to enter three parameters at a time:

1. The mysql version number to be installed, such as 5.6.24

2. Mysql port settings to be installed, such as 3306

3. Server_id settings of mysql, such as 1003306

Steps to use:

1. Upload the following script to the linux environment. I am personally named after mysql_install.sh

#! / bin/bash # mysql_install by chen # Email:chenhz1218@gmail.com & 296966488@qq.com # version 2.0 # installation requirements: # need to be able to connect to the Internet. If there is no network, you can first create a / data directory and upload the installation package to the / data directory. # determine whether the / data directory exists, and create it if it does not exist. And download mysql datamenu= "/ data" read-p "Input a mysql version:"-t 30 mysql_version read-p "Input a mysql port:"-t 30 mysql_port read-p "Input a mysql_server_id:"-t 30 mysql_server_id mysqlfile= "$datamenu/mysql-$mysql_version-linux-glibc2.5-x86_64.tar.gz" if [!-d "$datamenu"] Then mkdir "$datamenu" wget-P / data http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-$mysql_version-linux-glibc2.5-x86_64.tar.gz elif [!-f "$mysqlfile"] Then wget-P / data http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-$mysql_version-linux-glibc2.5-x86_64.tar.gz fi # unpack the downloaded mysql cd / opt mkdir mysql cd mysql tar zxvf $mysqlfile-C / opt/mysql # to create the mysql user egrep "^ mysql" / etc/group > & / dev/null if [$?-ne 0] then groupadd mysqlfi # create user if not exists egrep "^ mysql" / etc/passwd > & / dev/null if [$?-ne 0] then useradd-g mysql-s / sbin/nologin-d / usr/local/mysql mysql fi # create a mysql soft connection And authorize the mysql user cd / usr/local/ rm-rf / usr/local/mysql ln-s / opt/mysql/mysql-$mysql_version-linux-glibc2.5-x86_64 / usr/local/mysql chown-R mysql:mysql / usr/local/mysql chown-R mysql:mysql / usr/local/mysql/ # to create the mysql installation directory based on the configuration file And authorize mkdir-p / data/mysql mkdir-p / data/mysql/mysql$ {mysql_port} cd / data/mysql/mysql$ {mysql_port} / mkdir / data/mysql/mysql$ {mysql_port} / data mkdir / data/mysql/mysql$ {mysql_port} / logs mkdir / data/mysql/mysql$ {mysql_port} / tmp chown-R mysql:mysql / data/mysql/mysql$ {mysql_port} cat > / etc/my.cnf > / etc/profile export PATH=$PATH:/usr/local/mysql/bin

2. Give executable permissions to the script

[root@zabbix-server ~] # rz-y z waiting to receive.**B0100000023be50 [root@zabbix-server ~] # ls anaconda-ks.cfg install.log install.log.syslog mysql_install.sh [root@zabbix-server ~] # chmod + x mysql_install.sh [root@zabbix-server ~] # ls-al | grep mysql_install.sh-rwxr-xr-x. 1 root root 3136 Jul 29 10:29 mysql_install.sh

3. Execute the script and enter three parameters, waiting for the database to be installed

[root@MySQL] #. / mysql_install.sh Input a mysql version:5.6.24 Input a mysql port:3306 Input a mysql_server_id:1003306

4. Start the database

[root@MySQL ~] # / etc/init.d/mysql start Starting MySQL.. [OK] [root@zabbix-server ~] # mysql Welcome to the MySQL monitor. Commands end with; or\ g. Your MySQL connection id is 1 Server version: 5.6.24-log MySQL Community Server (GPL) Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement. Mysql > show databases->; +-+ | Database | +-+ | information_schema | | mysql | | performance_schema | | test | +-+ 4 rows in set (0.00 sec) mysql >

At this point, the installation of mysql under linux is complete, and you can use it to do some testing.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

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