Get the App
SLTechnology News&Howtos  ›  Database  › 

Using Shell script to realize the method of installing MySQL5.1.73 with source code

Shulou Source: shulou.com Published: 2022-06-01 18:57:07 09月11日 Update

The following is about using Shell scripts to achieve the source code installation MySQL5.1.73 method, the secret of the text is close to the topic. So, no gossip, let's go straight to the following, I believe you will benefit from reading this article on using Shell scripts to implement source code installation MySQL5.1.73 methods.

#! / bin/bash

# install mysql5.1.73 with DESCRIPTION source code

# before installing NOTICE, you need to put the source code package in the same path as the script

# # env setting

BASEDIR=/home/mysql

DATADIR=/home/data/mysql

PIDFILE=/home/mysql/mysql.pid

# # mysql base env install

Yum install gcc gcc-c++ cmake ncurses-devel-y

Yum groupinstall base "Development Tools"-y

# # create user

Groupadd mysql

Useradd-r-g mysql mysql

# # source package unzip

`- d mysql` | | mkdir mysql & & rm-rf mysql & & mkdir mysql

Tar zxvf mysql-5.1.73.tar.gz-C mysql

Mv. / mysql/mysql-5.1.73/*. / mysql/

Cd mysql

# # mysql install

. / configure-prefix=$BASEDIR-datadir=$DATADIR-with-mysqld-user=mysql-with-charset=utf8-with-extra-charsets=all

Make

Make install

Mkdir-p $DATADIR

Chown-R mysql:mysql $BASEDIR

Chown-R mysql:mysql $DATADIR

# # mysql initial

. / scripts/mysql_install_db-datadir=$DATADIR-user=mysql

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

Rm-f / etc/my.cnf

Cp support-files/my-large.cnf / etc/my.cnf

Chmod 755 / etc/init.d/mysqld

Sed-inr "s # ^ basedir=#basedir=$BASEDIR#g" / etc/init.d/mysqld

Sed-inr "s # ^ datadir=#datadir=$DATADIR#g" / etc/init.d/mysqld

Sed-inr "s # ^ pid_file=#pid_file=$PIDFILE#g" / etc/init.d/mysqld

Sed-I "/\ [mysqld\] / abasedir=$BASEDIR" / etc/my.cnf

Sed-I "/\ [mysqld\] / adatadir=$DATADIR" / etc/my.cnf

Sed-I "/\ [mysqld\] / apid_file=$PIDFILE" / etc/my.cnf

# # mysql environment variable

Export PATH=$PATH:/home/mysql/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

Source / etc/profile

# # service start and enanble

Chkconfig mysqld on

/ etc/init.d/mysqld start

For the above use of Shell scripts to achieve source code installation MySQL5.1.73 method related to the content, is there anything you do not understand? Or if you want to know more about it, you can continue to follow our industry information section.

Tags: Source code scripts methods the following topics content places mysteries text more sections articles industries information paths Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Xiaomi OPPO Reno Redmi Microsoft