mysql 5.6.31 linux安装,CentOS 7 源码安装MySQL 5.6.31(3)

[ 79%] Built target simple-t

[ 79%] Built target skip-t

[ 79%] Built target skip_all-t

[ 80%] Built target todo-t

[ 80%] Built target basic-t

[ 80%] Built target innochecksum

[ 80%] Built target my_print_defaults

[ 81%] Built target mysql_waitpid

[ 81%] Built target perror

[ 81%] Built target replace

[ 81%] Built target resolve_stack_dump

[ 81%] Built target resolveip

[ 82%] Built target mysql

[ 82%] Built target mysql_config_editor

[ 82%] Built target mysql_plugin

[ 83%] Built target comp_sql

[ 83%] Built target GenFixPrivs

[ 83%] Built target mysql_upgrade

[ 83%] Built target mysqladmin

[ 83%] Built target mysqlbinlog

[ 83%] Built target mysqlcheck

[ 83%] Built target mysqldump

[ 83%] Built target mysqlimport

[ 83%] Built target mysqlshow

[ 83%] Built target mysqlslap

[ 83%] Built target mysqltest

[ 84%] Built target bug25714

[ 84%] Built target mysql_client_test

[ 84%] Built target mysql_tzinfo_to_sql

[ 84%] Built target mysqld

[ 84%] Built target partition_embedded

[ 84%] Built target sqlgunitlib

[ 84%] Built target udf_example

[ 99%] Built target sql_embedded

[100%] Built target mysqlserver

[100%] Built target mysql_client_test_embedded

[100%] Built target mysql_embedded

[100%] Built target mysqltest_embedded

[100%] Built target my_safe_process

.....  安装日志省略,可附件下载

4. 安装后配置,包括CentOS 7服务配置

//添加服务用户

useradd -r -M -s /sbin/nologin mysql

//更改mysql安装目录属主 属组

cd /usr/local/mysql5.6/

chown -R mysql:mysql /usr/local/mysql5.6/

//创建

//配置my.cnf,从源码包中复制my.cnf文件

cd /usr/local/mysql5.6

cp my.cnf /etc/

//根据配置文件 配置各log sock pid目录的属主 属组

chown mysql:mysql ****** (省略)

//初始化数据库

cd /usr/local/mysql5.6/

scripts/mysql_install_db --user=mysql

//配置环境变量,把mysql/bin目录添加到PATH变量中

echo 'export PATH=$PATH:/usr/local/mysql5.6/bin' >> /etc/profile   &&   source /etc/profile

//试运行

mysqld_safe

//如果运行无报错的话,使用mysql客户端程序连接

mysql --protocol=tcp -h localhost -u root

//配置CentOS 7上的mysqld服务文件

cd /root/mysql-5.6.31/packaging/rpm-fedora/

cp mysqld.service /usr/lib/systemd/system

systemctl list-unit-files -t service | grep mysql

cd /etc/systemd/system/multi-user.target.wants/

ln -s /usr/lib/systemd/system/mysqld.service ./

//更改mysqld.service 默认配置

//可以把mysqld.service中的 ExecStartPre 和 ExecStartPost注释掉

//更改 ExecStart 项配置,路径必须为绝对路径,ExecStart=/usr/local/mysql5.6/bin/mysqld_safe

//测试mysqld.service 是否能够正常启动、重启、停止服务

systemctl daemon-reload

systemctl start mysqld.service

5. my.cnf配置举例

# For advice on how to change settings please see

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

[mysqld]

#

# Remove leading # and set to the amount of RAM for the most important data

# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.

# innodb_buffer_pool_size = 128M

#

# Remove leading # to turn on a very important data integrity option: logging

# changes to the binary log between backups.

# log_bin

#

# Remove leading # to set options mainly useful for reporting servers.

# The server defaults are faster for transactions and fast SELECTs.

# Adjust sizes as needed, experiment to find the optimal values.

# join_buffer_size = 128M

# sort_buffer_size = 2M

# read_rnd_buffer_size = 2M

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

# Recommended in standard MySQL setup

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

[client]

host=localhost

user=root

protocol=socket

socket=/var/lib/mysql/mysql.sock

6. mysqld.service配置举例

#

# Simple MySQL systemd service file

#

# systemd supports lots of fancy features, look here (and linked docs) for a full list:

#   http://www.freedesktop.org/software/systemd/man/systemd.exec.html

#

# Note: this file ( /usr/lib/systemd/system/mysqld.service )

# will be overwritten on package upgrade, please copy the file to

#

#  /etc/systemd/system/mysqld.service

#

# to make needed changes.

#

# systemd-delta can be used to check differences between the two mysqld.service files.

#

[Unit]

Description=MySQL Community Server

After=network.target

After=syslog.target

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值