mysql编译安装的shell脚本
编译安装的脚本卸载编译安装的mysql编译中出现的错误
编译安装的脚本
#
!/bin
/bash
set ff
=unix
user_check(){
if [ $
(id
-u
) != 0 ];then
echo
"-------------ERROT:Please use root to execute the script---------------"
sudo su
-
fi
}
user_check
apt update
apt install cmake bison libncurses5
-dev build
-essential
-y
if [ $
? != 0 ];then
echo
"----------------------------Install error!!!----------------------------"
exit
fi
cd
~
wget https
://dev
.mysql
.com
/get
/Downloads
/MySQL
-5.7/mysql
-boost
-5.7.18.tar
.gz
MYSQL
=mysql
-boost
-5.7.18.tar
.gz
if [ ! -f $MYSQL
];then
echo
"----------------------------Please confirm that the MYSQLfile exists!!!----------------------------"
exit
else
tar
-xzv
-f mysql
-boost
-5.7.18.tar
.gz
cd mysql
-5.7.18/
cmake
-DCMAKE_INSTALL_PREFIX
=/usr
/local
/mysql
-DMYSQL_DATADIR
=/usr
/local
/mysql
/data
-DWITH_BOOST
=./boost
/boost_1_59_0
-DSYSCONFDIR
=/etc
-DWITH_INNOBASE_STORAGE_ENGINE
=1 -DWITH_PARTITION_STORAGE_ENGINE
=1 -DWITH_FEDERATED_STORAGE_ENGINE
=1 -DWITH_BLACKHOLE_STORAGE_ENGINE
=1 -DWITH_MYISAM_STORAGE_ENGINE
=1 -DWITH_MEMORY_STORAGE_ENGINE
=1 -DENABLED_LOCAL_INFILE
=1 -DWITH_READLINE
=1 -DMYSQL_TCP_PORT
=3306 -DEXTRA_CHARSETS
=all
-DDEFAULT_CHARSET
=utf8
-DDEFAULT_COLLATION
=utf8_general_ci
make
&& make install
if [ $
? != 0 ];then
echo
"----------------------------Install error!!!----------------------------"
exit
fi
fi
groupadd mysql
useradd
-g mysql mysql
chown
-R mysql
/usr
/local
/mysql
chgrp
-R mysql
/usr
/local
/mysql
cp packaging
/rpm
-common
/my
.cnf
/etc
#sudo cp /usr/local/mysql/mysql-test/suite/group_replication/my.cnf /etc
cp
/usr
/local
/mysql
/support
-files
/mysql
.server
/etc
/init
.d
/mysqld
/usr
/local
/mysql
/bin
/mysqld
--initialize
-insecure
--user
=mysql
--basedir
=/usr
/local
/mysql
--datadir
=/usr
/local
/mysql
/data
--pid
-file
=/usr
/local
/mysql
/data
/mysql
.pid
systemctl restart mysql
ln
-s
/usr
/local
/mysql
/bin
/mysql
/usr
/bin
netstat
-anpt
| grep
3306
卸载编译安装的mysql
卸载:
#查看安装了MySQL的相关软件包
dpkg
--get
-selections
| grep mysql
#卸载MySQL
apt
-get remove
--purge mysql
-*
#清除本地残留文件
apt autoclean
#清除无用依赖包(可选)
apt autoremove
#删除MySQL残留文件
rm
-rf
/etc
/mysql
/var
/lib
/mysql
编译中出现的错误
Please submit a full bug report, with preprocessed source if appropriate. See http://bugzilla.redhat.com/bugzilla for instructions. make[2]: *** [sql/CMakeFiles/sql.dir/item_geofunc.cc.o] Error 4 make[1]: *** [sql/CMakeFiles/sql.dir/all] Error 2 make: *** [all] Error 2
这是内存不足引起的错误 添加内存就可以了