centos mysql 编译安装

1.安装

创建MySQL用户

sudo  useradd mysql

下载MySQL的源码包,我们这里使用的时5.5.18

安装依赖

sudo yum -y install cmake gcc-c++ make bison-devel ncurses-devel mysql-devel

防止内置的my.cnf捣乱

sudo mv /etc/my.cnf /etc/my.cnf.bak

解压源码包,

cd /home/xiaohe/tools
tar -zxf mysql-5.5.18.tar.gz
cd mysql-5.5.18
cmake -DCMAKE_INSTALL_PREFIX=/home/xiaohe/mysql -DMYSQL_UNIX_ADDR=/home/xiaohe/mysql/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_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/home/xiaohe/mysql/data make -j2 && make -j2 install

-j2 的2 指的是cpu核心数,有几个核心就是几

手动创建目录

cd /home/xiaohe/mysql && mkdir etc tmp var log

创建配置文件

vim etc/my.cnf
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /home/xiaohe/mysql/mysql.sock # Here follows entries for some specific programs # The MySQL server
[mysqld]
!include /etc/mysqld.cnf
port = 3306
socket = /home/xiaohe/mysql/mysql.sock
skip-external-locking
log-warnings = 2
log-error = /home/xiaohe/mysql/log/mysql.err
pid-file = /home/xiaohe/mysql/var/mysql.pid
basedir = /home/xiaohe/mysql/
datadir = /home/xiaohe/mysql/data/
log-queries-not-using-indexes
long-query-time = 1
#slow-query-log = 1
#slow-query-log-file= /home/xiaohe/mysql/log/slow.log
pid-file = /home/xiaohe/mysql/var/mysql.pid
tmpdir = /home/xiaohe/mysql/tmp/
slave-load-tmpdir = /home/xiaohe/mysql/tmp/
max_connections = 100
skip-name-resolve
skip-symbolic-links
slave-net-timeout=3
sync_binlog=1
relay_log_recovery=true
key_buffer_size = 16k
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
max_allowed_packet = 1M
table_open_cache = 4
net_buffer_length = 2K #default_table_type = INNODB
#transaction_isolation = REPEATABLE-READ innodb_status_file
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
innodb_data_home_dir = /home/xiaohe/mysql/data/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 8M
innodb_log_group_home_dir = /home/xiaohe/mysql/data/
innodb_log_file_size = 5M
innodb_log_files_in_group = 2
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 50 server-id = 1
log-bin=mysql-bin
binlog_format=mixed
log-slave-updates
replicate-wild-ignore-table=mysql.%
slave-skip-errors =1062
#read-only
#binlog-ignore-db=mysql
#binlog-do-db=mysql [mysqldump]
max_allowed_packet = 16M [mysql]
no-auto-rehash
max_allowed_packet = 16M [myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
read_buffer = 2M
write_buffer = 2M [mysqlhotcopy]
interactive-timeout

初始化数据库

/home/xiaohe/mysql/scripts/mysql_install_db

完成后启动数据库

/home/xiaohe/mysql/bin/mysqld_safe &

检查一下数据库进程,并登陆一下看看,默认没有密码。

修改mysql密码
mysql
mysql> use mysql;
mysql> UPDATE user SET password=password("123456") WHERE user='root';
mysql> flush privileges;
mysql> exit;
关闭mysql 设置superctl登陆
vim  /home/xiaohe/supervisor/conf/supervisord.conf

[program:mysql-3306]
command= /home/xiaohe/mysql-3306/bin/mysqld --defaults-file=/home/xiaohe/mysql-3306/etc/my.cnf
directory=/home/xiaohe/mysql-3306
user=xiaohe

查看状态

/home/xiaohe/superctl status

加载进去

/home/xiaohe/superctl update
授权
mysql>        grant select,insert,update,delete on *.* to 'root'@'%' identified by '123456' with grant option;

赋予任何主机访问数据的权限 具体根据实际情况授权,以权限最小化为准

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION

centos mysql 编译安装的更多相关文章

  1. Linux(centos)下mysql编译安装教程

    Linux下mysql编译安装教程 #查看linux发行版本 cat /etc/issue #查看linux内核版本号 uname -r 本文測试环境centOS6.6 一.Linux下编译安装MyS ...

  2. centos下编译安装lnmp

    centos下编译安装lnmp 本文以centos为背景在其中编译安装nginx搭建lnmp环境. 编译安装nginx时,需要事先安装 开发包组"Development Tools" ...

  3. Mysql编译安装及优化

    采取编译安装的方法,其好处为:编译安装与平台无关,安装的MySQL目录独立,维护起来方便,而且拥有更好的性能. 环境:CentOS release 6.9 (Final)  x86_64 1)下载my ...

  4. mysql 编译安装

    mysql 编译安装方式:   ```cd /home/oldboy/tools```                创建 目录          if not have   then     mkd ...

  5. CentOS 7 编译安装 Code::Blocks

    CentOS 7 编译安装 Code::Blocks yum install cairo-devel yum install pango-devel yum install atk-devel yum ...

  6. Nginx PHP MySql 编译安装

    以CentOS5.6为平台编译安装.确保系统已经安装gcc/gcc-c++编译器! 1.Nginx-1.0.14 2.PHP-5.3.10 3.MySql-5.1.61 安装相关依赖开发库: auto ...

  7. mysql编译安装(详细)(转载)

    mysql编译安装(详细)   一.编译安装MySQL前的准备工作 安装编译源码所需的工具和库 yum install gcc gcc-c++ ncurses-devel perl 安装cmake,从 ...

  8. rpm安装MySQL5.5后配置,在centos5上;mysql编译安装在centos6.5上;

    [1] 没有/etc/my.cnf: rpm包安装的MySQL是不会安装/etc/my.cnf文件的:处理:cp /usr/share/mysql/my-huge.cnf /etc/my.cnf [2 ...

  9. 20190418 CentOS7实用技能综合:系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/RocketMQ/RabbitMQ编译安装 + ...各类常用生产环境软件的编译安装

    系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/Roc ...

随机推荐

  1. “未能加载文件或程序集file:///E:/MoneySet.dll或它的某一个依赖项,试图加载格式不正确的程序,行203,位置5. 文件:MReportSet.resx”,

    http://bbs.csdn.net/topics/390334265 1.右键卸载项目2.右键选择编辑工程文件,在打开的文件的最后一行</project>之前加以下内容: <Pr ...

  2. Contest 高数题 樹的點分治 樹形DP

    高数题 HJA最近在刷高数题,他遇到了这样一道高数题.这道高数题里面有一棵N个点的树,树上每个点有点权,每条边有颜色.一条路径的权值是这条路径上所有点的点权和,一条合法的路径需要满足该路径上任意相邻的 ...

  3. [BZOJ 3888] [Usaco2015 Jan] Stampede 【线段树】

    题目链接:BZOJ - 3888 题目分析 首先,计算出每个线段在 x 坐标 0 处出现的时间开始点和结束点,就转成了时间轴上的线段. 然后就是看每条线段是否被 y 比它小的线段完全覆盖了.注意求出的 ...

  4. linux No manual entry for

    我的博客:www.while0.com 原来除了安装man,还要安装man-pages. yum install man -y yum install man-pages -y

  5. ping详解

    Linux系统的ping命令是常用的网络命令,它通常用来测试与目标主机的连通性,我们经常会说“ping一下某机器,看是不是开着”.不能打开网页时会说“你先ping网关地址192.168.1.1试试”. ...

  6. bzoj2653

    CLJ神牛的可持久化论文的题目,果然厉害其实第一步能想到后面就还是很简单的首先是二分答案,转化为判定性问题然后对于区间内的数,比他大的标为1,小的标为-1显然,如果存在一个左右端点符合的区间使得这个区 ...

  7. 怒刷BZOJ记录(二)1038~10xx

    我实在是太弱了...不滚粗只能刷BZOJ了...这里来记录每天刷了什么题吧. 2015-8-13: 正式开始! 1030[JSOI2007]文本生成器                       | ...

  8. WIA设备批量扫描

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  9. JavaScript 兼容处理IE67之 !"a"[0]

    IE67对字符串进行取值需要使用charAt()方法,不能直接通过数组方式的坐标访问: <!DOCTYPE html> <html> <head> <meta ...

  10. MVC 5 App 通过 Facebook OAuth2 登陆(Sign-on)的问题

    今天做了下MVC 5 App通过Google, Twitter, Linkedin 和 Facebook进行登录的例子, 算是对Asp.net Identity的一个入门,做的过程中发现了如下的问题, ...