#红色部分根据自己的需求来定义
#!/bin/bash
#卸载系统自带的Mysql
/bin/rpm -e $(/bin/rpm -qa | grep mysql|xargs) --nodeps
/bin/rm -f /etc/my.cnf #安装编译代码需要的包
/usr/bin/yum -y install make gcc-c++ cmake bison-devel ncurses-devel #编译安装mysql5.
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql -M -s /sbin/nologin
#转到/usr/local/src下
cd /usr/local/src #或是直接把tar包放在该目录下
#wget -c http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.6/mysql-5.6.36.tar.gz(此处填写正确的链接)
/bin/tar -zxvf mysql-5.6.31.tar.gz
cd mysql-5.6./
/usr/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DMYSQL_TCP_PORT= -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE= -DWITH_MYISAM_STORAGE_ENGINE= -DWITH_PARTITION_STORAGE_ENGINE= -DWITH_FEDERATED_STORAGE_ENGINE= -DWITH_BLACKHOLE_STORAGE_ENGINE= -DENABLED_LOCAL_INFILE= -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci
make && make install #修改/usr/local/mysql权限
mkdir -p /usr/local/mysql/data
/bin/chown -R mysql:mysql /usr/local/mysql
/bin/chown -R mysql:mysql /usr/local/mysql/data #执行初始化配置脚本,创建系统自带的数据库和表
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql #配置my.cnf
cat > /usr/local/mysql/my.cnf << EOF
[client]
port =
socket = /usr/local/mysql/mysql.sock [mysqld]
port =
socket = /usr/local/mysql/mysql.sock basedir = /usr/local/mysql/
datadir = /usr/local/mysql/data
pid-file = /usr/local/mysql/data/mysql.pid
user = mysql
bind-address = 0.0.0.0
server-id =
sync_binlog=
log_bin = mysql-bin skip-name-resolve
#skip-networking
back_log = max_connections =
max_connect_errors =
##open_files_limit =
table_open_cache =
max_allowed_packet = 16M
binlog_cache_size = 16M
max_heap_table_size = 16M
tmp_table_size = 256M read_buffer_size = 1024M
read_rnd_buffer_size = 1024M
sort_buffer_size = 1024M
join_buffer_size = 1024M
key_buffer_size = 8192M thread_cache_size = query_cache_size = 512M
query_cache_limit = 1024M ft_min_word_len = binlog_format = mixed
expire_logs_days = log_error = /usr/local/mysql/data/mysql-error.log
slow_query_log =
long_query_time =
slow_query_log_file = /usr/local/mysql/data/mysql-slow.log performance_schema =
explicit_defaults_for_timestamp ##lower_case_table_names = skip-external-locking default_storage_engine = InnoDB
##default-storage-engine = MyISAM
innodb_file_per_table =
innodb_open_files =
innodb_buffer_pool_size = 1024M
innodb_write_io_threads =
innodb_read_io_threads =
innodb_thread_concurrency =
innodb_purge_threads =
innodb_flush_log_at_trx_commit =
innodb_log_buffer_size = 4M
innodb_log_file_size = 32M
innodb_log_files_in_group =
innodb_max_dirty_pages_pct =
innodb_lock_wait_timeout = bulk_insert_buffer_size = 8M
myisam_sort_buffer_size = 8M
myisam_max_sort_file_size = 10G
myisam_repair_threads = interactive_timeout =
wait_timeout = [mysqldump]
quick
max_allowed_packet = 16M [myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
read_buffer = 4M
write_buffer = 4M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
port =
EOF #启动mysql服务
cd /usr/local/mysql
/bin/mkdir var
/bin/chown -R mysql.mysql var
cp support-files/mysql.server /etc/init.d/mysql
/sbin/chkconfig mysql on
service mysql start #设置环境变量
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile #设置mysql登陆密码,初始密码为123456
/bin/mkdir -p /var/lib/mysql
ln -s /usr/local/mysql/mysql.sock /var/lib/mysql/mysql.sock
mysql -e "SET PASSWORD = PASSWORD('123456');"
mysql -p123456 -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;"
mysql -p123456 -e "FLUSH PRIVILEGES;"

MySQL源码安装一键脚本的更多相关文章

  1. Mysql源码安装shell脚本

    #!/bin/bash#date:2019/1/20#by author zhangjia#install mysql#shell_name:mysql_auto_install.sh######## ...

  2. maridb\mysql 源码安装,以10.1.26版本为例

    mysql 源码安装(mariadb 10.1.26) 1.环境部署 1 安装cmake 源码安装三部曲或者yum install cmake2安装依赖包yum install -y ncurses- ...

  3. mysql源码安装(5.1)

    下载mysql源码包并解压.wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.73.tar.gztar -zxvf mysql-5 ...

  4. CentOS 7运维管理笔记(10)----MySQL源码安装

    MySQL可以支持多种平台,如Windows,UNIX,FreeBSD或其他Linux系统.本篇随笔记录在CentOS 7 上使用源码安装MySQL的过程. 1.下载源码 选择使用北理工的镜像文件: ...

  5. Linux MySQL源码安装缺少ncurses-devel包

    在Red Hat Enterprise Linux Server release 5.7 上用源码安装MySQL-5.6.23时,遇到了" remove CMakeCache.txt and ...

  6. Linux(CentOS或RadHat)下MySQL源码安装

    安装环境: CentOS6.3 64位 软件: Mysql-5.6 所需包: gcc/g++ :MySQL 5.6开始,需要使用g++进行编译.cmake  :MySQL 5.5开始,使用cmake进 ...

  7. mysql源码安装(包括5.5和5.7)

    1.mysql5.5源码安装 yum install -y cmake ncurses-devel ncurses cd /usr/src wget -c https://cdn.mysql.com/ ...

  8. MySQL源码安装(centos)

    1.去MySQL官网下载源码包 地址:http://dev.mysql.com/downloads/mysql/ 下载完后需要检查文件的MD5,以确认是否从官网下载的原版本(以防被人篡改过该软件) 使 ...

  9. zabbix,php,nginx,mysql源码安装 神仙操作

    →软件包 mkdir /soft/ cd /soft ♦下载以下软件包 nginx-1.14.2.tar.gz wget http://nginx.org/download/nginx-1.14.2. ...

随机推荐

  1. java.lang.IllegalStateException: Ambiguous mapping found

    原因:Controller 出现相同的url映射 参考: https://blog.csdn.net/u010892841/article/details/52136256

  2. Flask恋爱的一瞬间

    python的三大框架:Flask:轻量级框架 Django:重量级框架 Tornado:性能最好,异步框架 Flask初学 #导包 from flask import Flask #建立flask对 ...

  3. 项目:《JavaWeb图书管理系统视频》--代码修复还可以运行起来

    1. 系统设计--项目效果图请看最后面 1技术选型 (系统架构) JSTL + JSP + Servlet + JavaBean + BeanUtils + FileUpload + JavaMail ...

  4. super和this的区别

    this.:this加点指此时代表当前对象,能操作当前类里面的所有属性及方法以及父类继承而来能被访问修饰符允许的属性和方法.super.:此时指代当前对象类的父类对象部分,不能操作到本类的属性和方法, ...

  5. 解决Ubuntu 18.04中文输入法的问题,安装搜狗拼音

    首先安装fcitx一.检测是否安装fcitx首先检测是否有fcitx,因为搜狗拼音依赖fcitx> fcitx提示:程序“fcitx”尚未安装. 您可以使用以下命令安装:> sudo ap ...

  6. php编程 之php基础 表单

    1 ,php表单 当处理php表单的时候,php能把来自html页面的表单元素自动变成可供php脚本使用的数据. 比如: <html> <head> <meta char ...

  7. python,栈的小例子

    ''' 1.首先确认栈的概念,先进后出 2.初始化的时候如果给了一个数组那么就要将数组进栈 ''' class Stack: def __init__(self,start=[]): self.sta ...

  8. HBSX2019 3月训练

    Day 1 3月有31天废话 今天先颓过了就只剩30天了 初步计划 每天一道字符串/数据结构题 图论学习 根据<若干图论模型探讨>(lyd)复习 二分图与网络流学习 <算法竞赛进阶指 ...

  9. 【SVN】CentOS7.0下搭建SVN服务器

    SVN服务器搭建 最近接手了天赋吉运的SVN项目管理,那么学会搭建SVN服务器就成为了必须的技能.这篇文章就来讲一讲在CentOS7.0下如何搭建SVN服务器 1,下载安装SVN版本 yum inst ...

  10. Vue父子组件和非父子组件传值问题

    父组件跟子组件之间的传值(具体参考lonzhubb商城) 1.父组件传值给子组件形式,ifshop是要传的对象,右边ifshop代表要传的这个对象的数据,如果只是传常量,那么属性可以不用加':'(表示 ...