搜索
首页
笔记
案例
关于
课程列表
shell script
执行多个目录下的php脚本
内存检查超过设定值杀死所有php-fpm进程
监控httpd进程数
统计活动IP
判断pid是否一致
网站文件及数据库文件的备份
源码安装mysql
监控磁盘分区的使用率
监控网卡流量
批量创建用户、删除用户
监听端口情况
rm命令太危险,使用自定义的del代替
监控cpu状况
服务器文件备份脚本
课程导航
计算机基础知识
C
Linux
linux常用软件
计算机网络
程序员修养
设计模式
工具
Git
composer
vim
IntelliJ IDEA
wireshark
laravel
Spring
SpringMVC
Maven
数据库
MySQL
Redis
MongoDB
JDBC
Mybatis
MyBatis-Plus
服务端编程
PHP
Java
shell script
JavaWeb
HTML / CSS
HTML
CSS
HTML5
CSS3
BOOTSTRAP
JavaScript
JavaScript
JQuery
layui
网站文件及数据库文件的备份
监控磁盘分区的使用率
源码安装mysql
一般mysql的话,简易使用源码安装,自己编译,性能好点。一般服务,数据库压力最大。该脚本安装的mysql版本为5.7.26,含boost ```shell #!/bin/bash # mysql源码安装脚本 export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:~/bin export LANG=en flag=$? if [ $UID -ne 0 ];then echo 'Error: You must be root to run this script, please use root to install lnmp'; exit 1; fi if [ -z `grep SELINUX=disabled /etc/selinux/config` ];then echo 'Error:Please closed the selinux at first' exit 1; fi ping -c1 www.baidu.com if [ $flag -ne 0 ];then echo 'ping www.baidu.com failed' exit 1 fi if [ `ps aux | grep yum | grep -v grep` ];then echo 'yum is running' exit 1 fi echo '===============================================' mysqlDir="/usr/local/mysql" mysqlDataDir=$mysqlDir/var # mysql数据库放置位置 if [ -d $mysqlDir ];then echo 'mysql is exists' exit 1 fi read -p "please input your want to mysql data dir,default $mysqlDir/var:" inDir [ $inDir ] && mysqlDataDir=$inDir echo "your mysqldata's dir is $mysqlDataDir" # 新建mysql用户 id mysql >/dev/null 2>&1 || useradd -s /sbin/nologin -M mysql [ ! -d $mysqlDataDir ] && mkdir -p $mysqlDataDir chown mysql:mysql $mysqlDataDir # 删除系统自带的mariadb rpm -q mariadb-libs && rpm -e --nodeps mariadb # 安装依赖 for software in "wget make gcc-c++ cmake bison-devel ncurses-devel bison perl perl-devel perl perl-devel" do yum -y install $software done # 下载源码包 softwareDir=/usr/software #源码包下载放置位置 mysqlSoftUrl="https://blog.loveguiyuan.cn/static/software/mysql-5.7.26.tar.gz" echo 'mysql software downing...' [ -d $softwareDir ] || mkdir -p $softwareDir cd $softwareDir [ -f $softwareDir/mysql-5.7.26.tar.gz ] || wget -P $softwareDir $mysqlSoftUrl tar -zxf mysql-5.7.26.tar.gz && cd mysql-5.7.26 cmake \ -DCMAKE_INSTALL_PREFIX=$mysqlDir \ -DSYSCONFDIR=/etc \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DEXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_BOOST=boost make if [ $flag -eq 0 ];then make install else make clean echo 'mysql install failed' exit 1 fi if [ $flag -ne 0 ];then echo 'mysql install failed' exit 1 fi # mysql配置文件 cat > /etc/my.cnf <
/dev/null 2>&1; then systemctl enable mysqld.service fi /etc/init.d/mysqld start # 优化路径 cat >> /etc/profile <
网站文件及数据库文件的备份
监控磁盘分区的使用率
文章目录