CentOS6.5编译安装MySQL5.5

安装依赖包:
yum -y install gcc* gcc-c++* autoconf* automake* zlib* libxml* ncurses-devel* libgcrypt* libtool*
安装cmake:
[[email protected] usr]# wget http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz
[[email protected] usr]# tar xzvf cmake-2.8.12.tar.gz 
[[email protected]ocalhost usr]# cd cmake-2.8.12
[[email protected] cmake-2.8.12]# ./bootstrap 
[[email protected] cmake-2.8.12]# gmake 
[[email protected] cmake-2.8.12]# gmake install
添加MySQL用户和用户组:
[[email protected] cmake-2.8.12]# cd ~
[[email protected] ~]# groupadd mysql 
[[email protected] ~]# useradd -g mysql mysql
创建MYSQL安装目录并授权:
[[email protected] ~]# mkdir /usr/local/mysql
[[email protected] ~]# mkdir /usr/local/mysql/data
[[email protected] ~]# chown -R mysql:mysql /usr/local/mysql
下载MySQL源代码:
[[email protected] ~]# wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.45.tar.gz
[[email protected] ~]# tar xzvf mysql-5.5.45.tar.gz 
[[email protected] ~]# cd mysql-5.5.45
配置MySQL编译参数:
[[email protected] ~]#
					cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql 					-DMYSQL_DATADIR=/usr/local/mysql/data 					-DWITH_INNOBASE_STORAGE_ENGINE=1 					-DWITH_PARTITION_STORAGE_ENGINE=1 					-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 					-DWITH_MYISAM_STORAGE_ENGINE=1 					-DMYSQL_UNIX_ADDR=/usr/local/mysql/tmp/mysql.sock 					-DMYSQL_TCP_PORT=3306 					-DENABLED_LOCAL_INFILE=1 					-DWITH_EXTRA_CHARSETS=all 					-DDEFAULT_CHARSET=utf8 					-DDEFAULT_COLLATION=utf8_general_ci 					-DWITH_SSL=yes
进行编译安装:
[[email protected] ~]# make && make install
配置my.cnf:
[[email protected] support-files]# cd /usr/local/mysql/support-files
[[email protected] support-files]# cp my-medium.cnf /etc/my.cnf
[[email protected] support-files]# vim /etc/my.cnf
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
socket=/usr/local/mysql/tmp/mysql.sock
character-set-server=utf8
max_connections=300
default-storage-engine=InnoDB
collation-server=utf8_bin
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[client]
port=3306
default-character-set=utf8
[mysql]
no-auto-rehash
default-character-set=utf8
[safe_mysqld] 
err-log=/var/log/mysqld.log 
pid-file=/var/lib/mysql/mysql.pid
初始化数据库:
[[email protected] support-files]# 
								/usr/local/mysql/scripts/mysql_install_db 								--defaults-file=/etc/my.cnf 								--basedir=/usr/local/mysql 								--datadir=/usr/local/mysql/data 								--user=mysql
设置开机自启动 
[[email protected] support-files]# cp mysql.server /etc/init.d/mysqld
[[email protected] support-files]# chmod +x /etc/init.d/mysqld
[[email protected] support-files]# chkconfig --add mysqld
[[email protected] support-files]# chkconfig --level 345 mysqld on
启动服务:
[[email protected] support-files]# service mysqld start
设置密码:
[[email protected] support-files]# /usr/local/mysql/bin/mysqladmin password [new-password]
设置一个软链接:
[[email protected] support-files]# ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
登录MySQL:
[[email protected] support-files]# mysql -uroot -p
时间: 2024-12-02 06:18:03

CentOS6.5编译安装MySQL5.5的相关文章

centos6.7编译安装mysql5.7.17

centos6.7编译安装mysql5.7.17 2017-03-24 09:57:15 提示:mysql5.7.17和之前5.56以前的版本安装不一样,需要用cmake 另外,看本文档的mysql编译前我说一点,第一次一定要大概的看完整个过程,不能一直跟着文档做,否则后面容易遇到问题.比如编译完会特别占用磁盘空间,万一之前分配的空间不够,那样就会丢失很多重要文件导致失败. 安装前工作: 1,从官方网址下载MySQL5.7.17源码包 http://dev.MySQL.com/downloads

centos6.5编译安装mysql5.6.20

一.   准备工作 1     yum安装各个依赖包 [[email protected] ~]# yum –y install gcc gcc-devel gcc-c++ gcc-c++-devel  zlib*  ncurses-devel ncurses openssl openssl-devel bison bison-devel libaio [[email protected] ~]# yum –y install cmake 2.新建mysql组和用户 [[email protec

CentOS6.9编译安装MySQL5.7.16

部署环境: 系统CentOS6.9,mysql5.7.16,boost库 系统为2G内存 1.安装依赖包,使用yum安装cmake,6.9默认yum源自带 yum -y install gcc-c++ cmake bison-devel ncurses-devel 2.创建mysql的用户: useradd  -U -s /sbin/nologin mysql 3.创建必要的文件夹,并修改其目录用户所有者: mkdir -pv /usr/local/mysql/etc mkdir -pv /da

centos6.5编译安装mysql5.6.14

1 查看机器上是否装有mysql rpm -qa | grep mysql 2. 删除已经存在的mysql rpm -e --nodeps mysql ()强力删除模式) 3.安装编译代码需要的包 yum -y install gcc gcc-devel gcc-c++ gcc-c++-devel autoconf* automake* zlib* libxml* ncurses-devel ncurses libgcrypt* libtool* cmake openssl openssl-de

centos6.5编译安装mysql5.7.11

1.安装相关依赖包 yum -y install gcc* autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libmcrypt* libtool-ltdl-devel* 2.需要安装个包 安装cmake [email protected] src]# tar zxvf cmake-2.8.5.tar.gz [[email protected] src]# cd cmake-2.8.5 [[email protected

centos6.5 编译安装Mysql5.7.17

一.安装环境准备 centos 6.5 二.下载mysql source_code  这里说一下,进入myql下载页面后选择source_code:  然后选择 Generic Linux (Architecture Independent), Compressed TAR Archive   Includes Boost Headers 这个包下载.  也可以用下面的地址:  wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boo

centos6.7 编译安装mysql-5.6.27

安装依赖包: yum -y install make  gcc-c++ bison ncurses ncurses-devel 软件版本 cmake-2.8.8.tar.gz mysql-5.6.27.tar.gz 1.安装相关的包 1.2 cmake软件安装 cd /opt/tools tar xf cmake-2.8.8.tar.gz cd cmake-2.8.8 ./configure make && make install cd .. 如果安装源不稳定可以换 163或者 阿里云的

centos6.9编译安装mysql-5.6.36

一 安装相关软件包[[email protected] ~]# yum -y install ncureses-devel libaio-devel[[email protected] tools]# yum install cmake –y 创建mysql运行用户[[email protected] tools]# useradd -s /sbin/nologin -M mysql 下载软件包[[email protected] tools]# wget https://downloads.m

CentOS6.3_64编译安装MySQL-5.5.37数据库

1.下载cmake: http://wwwNaNake.org/files/v2.8/cmake-2.8.10.2.tar.gz ./configure make && make install 2.vi /etc/profile: export PATH=/usr/local/cmake-2.8.10.2/bin:$PATH source /etc/profile 3.wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.