下载源码wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.23.tar.gz

tar zxvf mysql-5.6.23.tar.gz

安装必要的包sudo yum install cmake gcc gcc-c++ ncurses-devel perl-Data-Dumper cmake ncurses-devel bison autoconf automake zlib* fiex* libxml* libmcrypt* libtool-ltdl-devel*

进入mysql源码目录,生成makefilecd mysql-5.6.23

cmake .

生成失败的的话rm -f CMakeCache.txt

查看问题,进行修复

编译并安装make

sudo make install

mysql将会安装到/usr/local/mysql路径。

添加mysql用户和组

先查看是否存在cat /etc/passwd | grep mysql

cat /etc/group | grep mysql

添加sudo groupadd mysql

sudo useradd -r -g mysql mysql

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

修改目录和文件权限,安装默认数据库cd /usr/local/mysql

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

至此,mysql就可以启动运行了。

启动mysql

CentOS7自带MariaDB的支持,/etc下默认存在my.cnf文件干扰mysql运行,需要先删掉cd /etc

sudo rm -fr my.cnf my.cnf.d

然后再/etc下重建my.cnf文件,内容如下# Foradvice onhow tochange settings please see

# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

[mysqld]

# Remove leading # andsettothe amount ofRAM forthe most important data

# cache inMySQL. Start at70% oftotal RAM fordedicated server, else10%.

# innodb_buffer_pool_size = 128M

# Remove leading # toturn ona very important data integrity option: logging

# changes tothe binarylog betweenbackups.

# log_bin

# These are commonly set, remove the # andsetasrequired.

# basedir = .....

# datadir = /data/mysql/data

?port = .....

# server_id = .....

# socket = .....

# Remove leading # tosetoptions mainly useful forreporting servers.

# The server defaults are faster fortransactions andfast SELECTs.

# Adjust sizes asneeded, experiment tofind the optimal values.

# join_buffer_size = 128M

# sort_buffer_size = 2M

# read_rnd_buffer_size = 2M

max_connection = 10000

sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

#binarylog

log-bin = mysql-bin

binlog_format = mixed

expire_logs_day = 30

#slow query log

slow_query_log = 1

slow_query_log_file = /var/log/mysql/slow.log

long_query_time = 3

log-queries-not-using-indexes

log-slow-admin-statements

?

innodb_log_files_in_group=2

innodb_data_home_dir = /opt/data/mysql/

innodb_data_file_path = ibdata1:2000M;ibdata2:2000M;ibdata3:20M:autoextend

innodb_log_group_home_dir = /opt/data/mysql/

# 4G RAM

innodb_buffer_pool_size = 1G

innodb_log_file_size = 256M

innodb_log_buffer_size = 8M

innodb_flush_log_at_trx_commit=0

innodb_thread_concurrency=8

innodb_flush_method=O_DIRECT

# perform

tmp_table_size = 512M

max_heap_table_size=128M

现在可以启动mysql了sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &

CentOS7 不能使用service控制mysql服务,而源码安装的mysql也没有提供Systemd的控制脚本。

开机启动

于是编辑/etc/rc.d/rc.local文件,添加mysql的开机启动命令。/usr/local/mysql/bin/mysqld_safe --user=mysql &

然后给/etc/rc.d/rc.local添加可执行权限sudo chmod a+x /etc/rc.d/rc.local

如果开启时报错 ,重新初始化,注意用户名别用错了sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &

修改root密码/usr/local/mysql/bin/mysql -uroot

use mysql;

select * from mysql?WHERE?user=?'root';

UPDATE user SET?password= PASSWORD('123456') WHERE?user= 'root';

GRANT ALL PRIVILEGES ON *.* TO [email protected]'%' IDENTIFIED BY '123456';

FLUSH PRIVILEGES;

至此,安装基本完成了,一个mysql就能用了。

启动mysql

添加服务,拷贝服务脚本到init.d目录,并设置开机启动$ cp support-files/mysql.server /etc/init.d/mysql

$ chkconfig mysql on

$ service mysql start –启动MySQL

查看是否启动成功netstat -lntp | grep 3306

centos 编译 mysql_Centos编译mysql相关推荐

  1. centos 编译 mysql_centos 编译安装mysql

    三.简单回顾: 0.准备磁盘,存放mysql的data文件 安装如果磁盘大于2t,需要安装parted,yum search parted   yum install xx fdisk –l  先查看 ...

  2. centos 默认mysql_centos改变mysql默认目录

    centos改变mysql默认目录 查看SELinux状态:如果未关闭,则要关闭 1./usr/sbin/sestatus -v ##如果SELinux status参数为enabled即为开启状态 ...

  3. centos 安装mysql_Centos 下mysql数据库完整安装过程

    1. 检查系统自带的Mysql,并卸载自带的版本 [root@iZ2366ycl7sZ config]# yum list installed |grep mysql mysql.x86_64 5.1 ...

  4. centos 使用mysql_Centos下MySQL使用总结

    转载于CentOS中文站:http://www.centoscn.com/CentOS/Intermediate/2013/0817/1334.html 一.MySQL安装 Centos下安装mysq ...

  5. mac远程连接centos安装mysql_centos安装Mysql并远程连接

    安装mysql 1.下载mysql源安装包 shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch ...

  6. CentOS 5.5 编译安装apache+php+mysql,利用CMS快速建立论坛

    这个是转来的,细节没有验证,请网友自己斟酌.......... CentOS 5.5 编译安装apache+php+mysql,利用CMS快速建立论坛 1.安装Apache [root@bogon t ...

  7. centos6.3 nginx php,CentOS 6.3 编译安装Nginx+MySQL+PHP

    测试篇 cd /usr/local/nginx/html/ #进入nginx默认网站根目录 rm -rf /usr/local/nginx/html/* #删除默认测试页 vi index.php # ...

  8. mysql+1.6安装,CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14方法

    这篇文章主要介绍了CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14方法分享,需要的朋友可以参考下准备篇: 一.配置防火墙,开启80端口.3306端口 Cen ...

  9. CentOS 7.0编译安装Nginx+MySQL+PHP

    转自http://www.centoscn.com/CentosServer/www/2014/0904/3673.html 准备篇: CentOS 7.0系统安装配置图解教程 http://www. ...

最新文章

  1. 威廉与玛丽学院读计算机博士,威廉与玛丽学院计算机科学(计算运算研究)理学硕士研究生申请要求及申请材料要求清单...
  2. 微信小程序页面文字超出一行隐藏,文字超出两行隐藏。
  3. dell 2950 raid阵列冷迁移方法
  4. Eclipse的Spring库导入
  5. Java函数式编程-三更草堂-学习笔记
  6. 如何用计算机放出音乐,如何录制电脑内部播放的声音及音乐 - 楼月语音聊天录音软件...
  7. spss数据预处理步骤_关于SPSS数据预处理心得
  8. mysql设计一个网上购物系统_基于PHP和MySQL的网上购物系统设计与实现
  9. 八皇后算法带给我们的启示吧
  10. kafka中topic默认属性_Kafka的Topic配置详解
  11. PS图层模式详细讲解
  12. 转:Cookie MappingRTB,SSP,DSP,Ad Exchange
  13. C语言读取mp3文件的信息
  14. Qt实现Linux下的硬盘空间监测和文件清理
  15. apt-get update和apt-get upgrade的区别
  16. 热部署与定时任务冲突问题解决方案
  17. 比尔盖茨10句至理名言
  18. php 数组 时间戳排序,php – 按时间戳排序Summed Collection
  19. Oracle索引梳理系列(六)- Oracle索引种类之函数索引
  20. Electron+Vue的开发经验

热门文章

  1. ATS 5.3.0中parent.config配置文件解读
  2. UE capability与 双连接相关的参数。
  3. C语言 #ifndef 引起的redefinition of xxx 问题解决
  4. 再记一次ceph object unfound的艰辛历程
  5. C++多线程:thread类创建线程的多种方式
  6. Request.getInputStrema只能读取一次的分析过程
  7. Fragment为什么须要无参构造方法
  8. 微软2014校园招聘笔试试题
  9. Eclipse插件的安装方法
  10. java 中的 Enumeration 在Vector,Hashtable和web中的应用