Centos-6.6源码安装MySQL-5.5

1.安装环境

[[email protected] ~]# cat /etc/redhat-release
CentOS release 6.6 (Final)

[[email protected]-mysql-server ~]# uname -r
2.6.32-504.el6.x86_64

2.环境初始化

[[email protected] ~]#  /etc/init.d/iptables stop   #关闭防火墙

[[email protected]-mysql-server ~]#  chkconfig iptables off    #禁止开机自启动

[[email protected]-mysql-server ~]#  sed -ri ‘s#SELINUX=enforcing#SELINUX=disabled#g‘ /etc/selinux/config  #关闭SElinux

[[email protected]-mysql-server ~]#  setenforce 0        #临时关闭SElinux

[[email protected]-mysql-server ~]#  ntpdate ntp.api.bz  #时间同步

#添加定时任务
[[email protected]-mysql-server ~]#  echo "*/5 * * * * $(which ntpdate) ntp.api.bz &> /dev/null" >> /var/spool/cron/root

3.安装

[[email protected] ~]# useradd -s /sbin/nologin  -M mysql

#解析主机名
[[email protected]-mysql-server ~]# echo "$(ifconfig eth0|awk -F ‘[: ]+‘ ‘NR==2 {print $4}‘) $(hostname)" >> /etc/hosts

#安装cmake编译工具和依赖库
[[email protected]-mysql-server ~]# yum install cmake ncurses-devel –y

[[email protected]-mysql-server ~]# cd tools/
[[email protected]-mysql-server tools]# tar -xf mysql-5.5.32.tar.gz

[[email protected]-mysql-server tools]# cd mysql-5.5.32

[[email protected]-mysql-server mysql-5.5.32]# cmake -DCMAKE_INSTALL_PREFIX=/app/mysql-5.5.32 -DMYSQL_DATADIR=/app/mysql-5.5.32/data -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/app/mysql-5.5.32/data/mysqld.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_READLINE=1 -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1

[[email protected]-mysql-server mysql-5.5.32]# make && make install
[[email protected]-mysql-server mysql-5.5.32]# ln -s /app/mysql-5.5.32 /app/mysql
[[email protected]-mysql-server mysql-5.5.32]# cd /app/mysql/scripts 

#初始化
[[email protected]-mysql-server scripts ]# ./mysql_install_db --basedir=/app/mysql --datadir=/app/mysql/data/ --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/app/mysql/bin/mysqladmin -u root password ‘new-password‘
/app/mysql/bin/mysqladmin -u root -h linux-mysql-server.com password ‘new-password‘

Alternatively you can run:
/app/mysql/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /app/mysql ; /application/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /app/mysql/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /app/mysql/scripts/mysqlbug script!

[[email protected]-mysql-server scripts ]# /bin/cp  /app/mysql/support-files/my-small.cnf  /etc/my.cnf
[[email protected]-mysql-server scripts ]# /bin/cp  /app/mysql/support-files/mysql.server  /etc/init.d/mysqld 

#添加环境变量
[[email protected]-mysql-server scripts ]#  echo "export PATH=$PATH:/app/mysql/bin" >> /etc/profile
[[email protected]-mysql-server scripts ]# . /etc/profile

[[email protected]-mysql-server scripts ]# /etc/init.d/mysqld start  #启动

[[email protected]-mysql-server scripts ]# mysqladmin -uroot password #设置新密码

原文地址:https://www.cnblogs.com/it-art/p/11383647.html

时间: 2024-10-19 12:33:53

Centos-6.6源码安装MySQL-5.5的相关文章

CentOS 7下源码安装MySQL 5.7

网上说linux安装mysql服务分两种安装方法: ①源码安装,优点是安装包比较小,只有几十M左右,缺点是安装依赖的库多,安装编译时间长,安装步骤复杂容易出错: ②使用官方编译好的二进制文件安装,优点是安装速度快,安装步骤简单,缺点是安装包很大,300M左右(5.7版本的是600M左右), 对于第二种方法,我搞了一天,无果,到某个环节实在是无法走通,老大那边也不让搞了,隔了几天老大又吩咐我在生产服务器上安装mysql,这次我就按照第一种方法源码安装方式 下载源码安装包 http://dev.my

CentOS 6.4 源码安装MySQL 5.6

1.安装前准备工作 1.1 必备的包 gcc/g++ :MySQL 5.6开始,需要使用g++进行编译.cmake :MySQL 5.5开始,使用cmake进行工程管理,cmake需要2.8以上版本.bison :MySQL语法解析器需要使用bison进行编译.ncurses-devel :用于终端操作的开发包. 1.2 MySQL编译参数 CMAKE_BUILD_TYPE 编译的版本类型:RelWithDebInfo和Debug,不同之处是RelWithDebInfo会进行优化.CMAKE_I

centos 6.3 源码安装mysql

偶这台破笔记本慢得要死,今天又重装系统,神马东东软件都要重装一遍啦(:-O),果断先把虚拟机给搭上先^-^,重装了LAMP.mysql源码安装步骤如下:1:由于是新安装的系统,还是min版的,所以要安装一些依赖 yum install -y gcc gcc-c++ ncurses-devel make cmake bison: 2:添加mysql组与用户名(我的是新系统就不用检查组和用户是否存在了,可以用命令 cat /etc/group | grep mysql 与 cat /etc/pass

CentOS 6.8 源码安装mysql 5.6

一:卸载旧版本 rpm -qa | grep mysql rpm -e mysql #普通删除模式 rpm -e --nodeps xxx(xxx为刚才的显示的列表) # 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除 rm /etc/my.cnf #删除/etc/my.cnf 二:安装编译代码需要的包 yum -y install make gcc-c++ cmake bison-devel ncurses-devel 三:创建mysql用户(但是不

CentOS 6.3 源码安装LAMP(Linux+Apache+Mysql+Php)环境

一.简介 什么是LAMP LAMP是一种Web网络应用和开发环境,是Linux, Apache, MySQL, Php/Perl的缩写,每一个字母代表了一个组件,每个组件就其本身而>言都是在它所代表的方面功能非常强大的组件. LAMP这个词的由来最早始于德国杂志“c't Magazine”,Michael Kunze在1990年最先把这些项目组合在一起创造了LAMP的缩写字.这些>组件并不是开始就设计为一起使用的,但是,这些软件都是开源的,可以很方便的随时获得并免费使用,这就导致了这些组件经常

centos下lamp源码安装

LAMP指的Linux(操作系统).ApacheHTTP 服务器,MySQL(有时也指MariaDB,数据库软件) 和PHP(有时也是指Perl或Python) 的第一个字母,一般用来建立web 服务器. 安装mysql这里我们用的是mysql-5.6.15-linux-glibc2.5-x86_64.tar.gz的绿色软件包 解压mysql绿色软件包 [[email protected] lamp]# tar -zxvf mysql-5.6.15-linux-glibc2.5-x86_64.t

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

centos6.5下源码安装mysql密码修改

Centos下源码安装mysql密码破解方法: 方法一:首先停止mysql服务,: /etc/init.d/mysqldstop 停止mysql ps -ef |grep mysql 查看mysql是否关闭 然后以跳过权限方式后台启动 /usr/local/mysql/bin/mysqld_safe--skip-grant-tables --user=mysql & /usr/local/mysql/bin/mysql进入mysql 或者执行mysql回车进入mysql,然后修改密码. 修改My

源码安装mysql

创建mysql组:groupadd mysql 创建mysql用户并赋予这个mysq组中,不创建家目录,不允许用户登录.(因为刚刚创建的mysql是虚拟用户,所以不允许登录)useradd mysql -g mysql -M -s /bin/nologin 源码安装mysql 解压后进行编译安装:./configure \--prefix=/application/mysql5.1.72 \--with-unix-socket-path=/application/mysql5.1.72/tmp/

源码安装mysql,及主从同步

源码安装mysql [可选] 如果用源码安装cmake软件: cd /home/oldboy/tools/ tar xf cmake-2.8.8.tar.gz cd cmake-2.8.8 ./configure #CMake has bootstrapped. Now run gmake. gmake gmake install cd ../ 依赖包安装(这里直接可以用yum安装cmake) # yum install cmake gcc gcc-c++ gcc-g77 autoconf au