redhat6.4源码安装mysql5.6

准备:

下载MySQL源码文件包:https://edelivery.oracle.com/  去网站注册登录找到需要的源码包进行下载。

yum remove *mysql*
find / -name mysql  --删除旧文件目录

创建用户:

groupadd mysql1    --创建mysql1的组
useradd -g mysql1 mysql1   --创建mysql1的用户
passwd mysql1

安装依赖包:

cp -r mysql-5.6.25 /home/mysql1
chown -R mysql1:mysql1 /home/mysql1
yum install make gcc-c++ cmake bison ncurses ncurses-devel

安装:

su - mysql1
cd  /home/mysql1/mysql-5.6.25
cmake -DCMAKE_INSTALL_PREFIX=/home/mysql1/mysql \ --安装目录
-DMYSQL_DATADIR=/home/mysql1/mysql/data \ --目录文件
-DSYSCONFDIR=/home/mysql1/mysql\ --配置文件
-DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/home/mysql1/mysql/mysql.sock \ --sock文件路径
-DMYSQL_TCP_PORT=3306 \ --端口
-DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 \ --字符编码
-DDEFAULT_COLLATION=utf8_general_ci    --回车等待cmake完成
make && make install

配置环境变量:

vi .bash_profile
export MYSQL_HOME=/home/mysql1/mysql
export PATH=$MYSQL_HOME/bin:$PATH

编辑/home/mysql1/mysql/my.cnf参数文件:

[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

# These are commonly set, remove the # and set as required.
basedir = /home/mysql1/mysql
datadir = /home/mysql1/mysql/data
port = 3306
server_id = 1
socket = /home/mysql1/mysql/mysql.sock
pid-file = /home/mysql1/mysql/mysql.pid

#long_query_time = 1
#log-slow-queries = /home/mysql1/mysql/mysql-slow.log

# 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

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

保存退出;

注册服务:

cp /home/mysql1/mysql/support/mysql.server /etc/rc.d/init.d/mysql1
chkconfig --add mysql1
service mysql1 start

初始化数据库:

scripts/mysql_install_db --basedir=/home/mysql1/mysql --datadir=/home/mysql1/mysql/data --user=mysql1 --user为系统登录用户

更改root初始密码:

mysqladmin -uroot password ‘mysql1‘

登录:

mysql -uroot -p  --进行登录

[同台服务器安装第二个mysql]

groupadd mysql2
useradd -g mysql2 mysql2
cp -r mysql-5.6.25 /home/mysql2
cmake -DCMAKE_INSTALL_PREFIX=/home/mysql2/mysql -DMYSQL_DATADIR=/home/mysql2/mysql/data -DSYSCONFDIR=/home/mysql2/mysql-DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/home/mysql2/mysql/mysql.sock -DMYSQL_TCP_PORT=3307 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make && make install
vi .bash_profile
export MYSQL_HOME=/home/mysql2/mysql
export PATH=$MYSQL_HOME/bin:$PATH

编辑/home/mysql1/mysql/my.cnf

[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

# These are commonly set, remove the # and set as required.
basedir = /home/mysql2/mysql
datadir = /home/mysql2/mysql/data
port = 3307
server_id = 2
socket = /home/mysql2/mysql/mysql.sock
pid-file = /home/mysql2/mysql/mysql.pid

#long_query_time = 1

# 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

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

保存退出;

cp /home/mysql2/mysql/support/mysql.server /etc/rc.d/init.d/mysql2
chkconfig --add mysql2
service mysql2 start
/home/mysql2/mysql/scripts/mysql_install_db --basedir=/home/mysql2/mysql --datadir=/home/mysql2/mysql/data --user=mysql2 --user为系统登录用户
mysqladmin -uroot password ‘mysql2‘
mysql -uroot -p  --进行登录
时间: 2024-11-07 22:26:25

redhat6.4源码安装mysql5.6的相关文章

源码安装mysql5.6.20&&mysql主从设置(多实例做多个主从)

一.源码安装mysql5.6.20 1.编译环境安装 yum install wget gcc* make openssl openssl-devel openssl-clients -y && yum groupinstall "Development Libraries" -y 2.源码下载(软件见Linux部署源码包) wget -P /usr/local/src/ http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.

MYSQL Study案例之--RedHat EL55源码安装Mysql-5.6

MYSQL  Study案例之--RedHat EL55源码安装Mysql-5.6 系统环境: 操作系统:RedHat EL55 DB Soft:  Mysql 5.6.4-m7 1.系统环境 [[email protected] Packages]# uname -a Linux rh6 2.6.18-194.el5.xen #1 SMP Tue Jan 29 11:47:41 EST 2013 i386 i686 GNU/Linux [[email protected] Packages]#

Linux下源码安装Mysql5.5

本文主要介绍了如何在源码安装mysql5.5,所用系统为CentOS6.5 一.安装相应的开发环境 yum install -y ncurses-devel yum install -y libaio yum install -y bison yum install -y gcc-c++ yum install -y openssl-devel 二.安装cmake 跨平台编译器 # tar xf cmake-2.8.8.tar.gz # cd cmake-2.8.8 # ./bootstrap

CentOS 6.5 源码安装MySQL5.6

CentOS 6.5 源码安装MySQL5.6 1:下载安装cmake (mysql5.5以后是通过cmake来编译的) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 #http://download.csdn.net/detail/csxuedn/7976005 #wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz # tar -zxv -f /root/cmake-2.8.4.tar.gz

源码安装mysql5.6x启动报错:[ERROR] Can't find messagefile '/data/mysqldata/3306/english/errmsg.sys'

170502 10:43:40 mysqld_safe Starting mysqld daemon with databases from /data/mysqldata/3306/data 2017-05-02 10:43:40 0 [Warning] The syntax '--language/-l' is deprecated and will be removed in a future release. Please use '--lc-messages-dir' instead.

一、源码安装mysql5.6-单实例

一.源码安装mysql5.6-单实例 1.  安装前检查系统环境 1.1 操作系统版本及内核版本 [[email protected] ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.5 (Santiago) [[email protected] ~]# uname –r 2.6.32-431.el6.x86_64 1.2 selinux是否处于关闭状态 [[email protected] ~]# ge

CentOS-6.4-minimal版中源码安装MySQL-5.5.38

/** * CentOS-6.4-minimal版中源码安装MySQL-5.5.38 * ---------------------------------------------------------------------------------------------------------------------- * 三种安装方式 * 1)源码安装 * 2)二进制包安装 * 3)rpm或yum安装 * 本文演示的是源码安装,并且,从mysql-5.5开始,源码安装要通过cmake安装

在rhel7.2下源码安装mysql-5.6.35

如何在一台新机rhel7.2下源码安装mysql-5.6.35 一.前期准备工作 1.首先安装依赖包,避免在安装过程中出现问题 yum -y install gcc gcc-c++ cmake ncurses-devel autoconf perl perl-devel 2.下载源码包 源码包地址:https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.35.tar.gz 3.创建mysql安装目录以及数据存放目录 [[email prot

centos 7.4源码安装mysql5.5.20

安装环境: centos 7.4 + mysql 5.5.20 步骤: (1)     源码安装MYSQL5.5.20方法,通过cmake.make.make install三个步骤实现. 安装mysql需要的包:yum install -y cmake make gcc gcc-c++ wget ncurses-devel cmake make perl ncurses-devel openssl-devel bison-devel libaio libaio-devel PCRE是一个Per