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

Sample Analysis of mysql script installation

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

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you the "sample analysis of mysql script installation", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "sample analysis of mysql script installation" this article.

Script installation

#! / bin/bash

Echo "- start install mysql--"

# install the necessary packages

Yum-y install gcc gcc-c++ ncurses openssl openssl-devel make kernel-devel M4 ncurses-devel libtool*

# create a data storage file

Mkdir-p / data/dbdata

# check whether mysql groups and users are stored. If not, create them.

If [`grep "mysql" / etc/passwd | wc-l`-eq 0]; then

Echo "adding user mysql"

/ usr/sbin/groupadd mysql

/ usr/sbin/useradd-g mysql mysql

Else

Echo "mysql user is exist"

Fi

# download mysql5.1tar package

Wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.63.tar.gz

Echo "tar xzvf mysql-5.1.63.tar.gz"

# decompress the tar package

Tar xzvf mysql-5.1.63.tar.gz

# enter the installation directory to install

Cd mysql-5.1.63

Echo "configuring mysql,please wait-"

# compile and configure prefix as the software installation directory, localstatedir as the data storage directory, etc.

. / configure'--prefix=/usr/local/mysql''--localstatedir=/data/dbdata/''--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock''--with-charset=utf8'

'--with-extra-charsets=complex''-- with-pthread''--enable-thread-safe-client''--with-ssl''--with-client-ldflags=-all-static'

'--with-mysqld-ldflags=-all-static''-- with-plugins=partition,federated,innobase,csv,blackhole,myisam,innodb_plugin,heap,archive'

'--enable-shared''-- enable-assembler'

If [$?-ne 0]; then

Echo "configure filed, please check it out!"

Exit 1

Fi

# Editing

Echo "make mysql, please wait for 20 minutes"

Make

If [$?-ne 0]; then

Echo "make filed, please check it out!"

Exit 1

Fi

# compile and install

Make install

# change relevant directory permissions

Chown-R mysql:mysql / usr/local/mysql

Chown-R mysql.mysql / data/dbdata/

# create a system data sheet

/ usr/local/mysql/bin/mysql_install_db-- user=mysql

Cp.. / my.cnf / etc/my.cnf

Cp / usr/local/mysql/share/mysql/mysql.server / etc/rc.d/init.d/mysqld

Chkconfig-add mysqld

Chkconfig-level 2345 mysqld on

Cp / usr/local/mysql/bin/mysql* / usr/bin/

Echo "mysql starting"

/ etc/rc.d/init.d/mysqld start

If [$?-ne 0]; then

Echo "mysql start filed, please check it out!"

Else

Echo "mysql start successful,congratulations!"

Fi

The above is all the contents of the article "sample Analysis of mysql script installation". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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