我是靠谱客的博主 笨笨太阳,最近开发中收集的这篇文章主要介绍mysql 脚本 linux_linux一键安装mysql脚本,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

#!/bin/sh

if [ -s /etc/my.cnf ];then

rm -rf /etc/my.cnf

fi

echo "----------------------------------start install mysql -----------------------------"

yum install -y ncurses gcc gcc-c++ ncurses ncurses-devel openssl openssl-devel libtool* cmake

mkdir -p /data/mysql

if [ ‘grep "mysql" /etc/passwd | wc -l‘ ]; then

echo "adding user mysql"

groupadd mysql

useradd -s /sbin/nologin -M -g mysql mysql

else

echo "mysql user exists"

fi

echo "-------------------------------downloading mysql----------------------------------"

wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.46.tar.gz

echo "------------------------------unpackaging mysql -----------------------------------"

tar -xvf mysql-5.5.46.tar.gz

cd mysql-5.5.46

echo "-------------------------configuring mysql,please wait-----------------"

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock

-DDEFAULT_CHARSET=utf8

-DDEFAULT_COLLATION=utf8_general_ci

-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk

-DWITH_MYISAM_STORAGE_ENGINE=1

-DWITH_INNOBASE_STORAGE_ENGINE=1

-DWITH_MEMORY_STORAGE_ENGINE=1

-DWITH_READLINE=1

-DENABLED_LOCAL_INFILE=1

-DMYSQL_DATADIR=/var/mysql/data

-DMYSQL_USER=mysql

if [ $? -ne 0 ];then

echo "configure failed ,please check it out!"

exit 1

fi

echo "make mysql, please wait for 20 minutes"

make

if [ $? -ne 0 ];then

echo "make failed ,please check it out!"

exit 1

fi

make install

chown -R mysql:mysql /usr/local/mysql

chown -R mysql.mysql /data/mysql/

/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql

#chown -R mysql /usr/local/mysql/var

chgrp -R mysql /usr/local/mysql/

cp -f ./support-files/my-large.cnf /etc/my.cnf

sed -i ‘s#^thread_concurrency = 8#& ndatadir = /data/mysql#g‘ /etc/my.cnf

cp ./support-files/mysql.server /etc/rc.d/init.d/mysql

chmod 755 /etc/init.d/mysql

#chkconfig --add mysqld

#chkconfig --level 2345 mysqld on

ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql

ln -s /usr/local/mysql/include/mysql /usr/include/mysql

ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql

ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump

ln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk

ln -s /usr/local/mysql/bin/mysqld_safe /usr/bin/mysqld_safe

echo "mysql starting"

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

if [ $? -ne 0 ];then

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

else

echo "mysql start successful,congratulations!"

fi

linux一键安装mysql脚本

标签:脚本   linux   tor   tar -xvf   level   read   chm   libtool   star

本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉

本文系统来源:https://www.cnblogs.com/henrylinux/p/9931316.html

最后

以上就是笨笨太阳为你收集整理的mysql 脚本 linux_linux一键安装mysql脚本的全部内容,希望文章能够帮你解决mysql 脚本 linux_linux一键安装mysql脚本所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(35)

评论列表共有 0 条评论

立即
投稿
返回
顶部