基于通用二进制格式安装mysql

实验环境:

Linux主机:centos6.8

mysql二进制格式包:mysql-5.5.52-linux2.6-x86_64.tar.gz

1、解压包到特定目录

[root@centos6 ~]# tar xf mysql-5.5.52-linux2.6-x86_64.tar.gz -C /usr/local/

2、创建软链接

[root@centos6 ~]# ln -sv /usr/local/mysql-5.5.52-linux2.6-x86_64/ /usr/local/mysql
`/usr/local/mysql' -> `/usr/local/mysql-5.5.52-linux2.6-x86_64/'

3、进入该目录、查看安装帮助,开始安装

[root@centos6 ~]# cd /usr/local/mysql
[root@centos6 mysql]# cat INSTALL-BINARY
//根据提示到指定网站查看帮助

基于通用二进制格式安装mysql

[root@centos6 mysql]# groupadd mysql   
[root@centos6 mysql]# useradd -r -g mysql -s /bin/false mysql //原来存在则不需要执行
[root@centos6 mysql]# chown -R mysql .
[root@centos6 mysql]# chgrp -R mysql .
[root@centos6 mysql]# ./scripts/mysql_install_db --help
//查看选项
我们这里不使用它默认的数据库存放位置
[root@centos6 mysql]# mkdir -pv /mysql/data/
//数据库文件最好放在 硬raid 的 LVM 上
[root@centos6 mysql]# chown mysql:mysql /mysql/data/
[root@centos6 mysql]# ll -d /mysql/data/
drwxr-xr-x. 2 mysql mysql 4096 Sep 16 21:44 /mysql/data/
[root@centos6 mysql]# ./scripts/mysql_install_db --datadir=/mysql/data/ --user=mysql
[root@centos6 mysql]# ls /mysql/data/
mysql  performance_schema  test //数据库初始化时生成的三个系统的数据库文件

基于通用二进制格式安装mysql

[root@centos6 mysql]# cp support-files/my-medium.cnf /etc/my.cnf 
cp: overwrite `/etc/my.cnf'? y  //不使用系统上默认安装的mysql数据库则可以覆盖原来的配置文件
[root@centos6 mysql]# vim /etc/my.cnf

基于通用二进制格式安装mysql

[root@centos6 mysql]# cp support-files/mysql.server /etc/init.d/mysqld.server
[root@centos6 mysql]# chkconfig --add mysqld.server

4、测试启动

[root@centos6 mysql]# service mysqld.server start
Starting MySQL..                                           [  OK  ]
[root@centos6 mysql]# ss -tln
LISTEN      0      50         *:3306

启动成功

此时数据库目录下会多出许多的文件或目录

5、最后的配置

导出man文档
[root@centos6 ~]# vim /etc/man.config 
MANPATH /usr/local/mysql/man  --> 添加该行


导出头文件
[root@centos6 ~]# ln -sv /usr/local/mysql/include/ /usr/include/mysql
`/usr/include/mysql' -> `/usr/local/mysql/include/'


导出库文件
[root@centos6 ~]# vim /etc/ld.so.conf.d/mysql.conf
/usr/local/mysql/lib


重新加载系统库文件
[root@centos6 lib]# ldconfig -v


导出二进制程序路径
[root@centos6 ~]# vim /etc/profile.d/mysql.sh
[root@centos6 ~]# . /etc/profile.d/mysql.sh

OK

原创文章,作者:sixijie,如若转载,请注明出处:http://www.178linux.com/55476

(0)
sixijiesixijie
上一篇 2016-10-29 13:57
下一篇 2016-10-29 15:28

相关推荐

  • N28 第三周【2】:用户和组管理

    用户和组管理 前言 Linux用户管理非常关键且重要,Linux的所有进程都是以不同的身份拥有不同的权限来运行和调度资源的。但是我们不用费劲心思去管理,因为系统将用户划分成为了两部分:无所不能的root用户和普通用户。同时呢,又将普通用户分为系统用户和登录用户。对于Linux,他会用UID去快速识别用户身份,对于我们,可以用用户名去识别。 接下来介绍一下用户…

    Linux干货 2017-12-19
  • pxe和dhcp服务——引导安装操作系统

    BootStraping:系统提供(OS Provision) pxe –> preboot excution environment, Intel cobbler –> Cobbler is a network install server.  Cobbler supports PXE, ISO virtual…

    Linux干货 2016-11-05
  • 浅谈Nginx(二)—http下server配置

    浅谈Nginx(二)—http下server配置 此文介绍Nginx下的http模块,着重介绍http模块下的server服务 ——–依据”马哥教育”主讲人马永亮导师的上课笔记整理——- 目录  一. http相关的基本配置:     1)…

    系统运维 2017-02-07
  • 安装CentOS 7.2操作系统

        工具:     VMware Workstation     http://www.vmware.com/cn/products/workstation/workstation-evaluation.html  &nbsp…

    Linux干货 2016-08-04
  • 在linux中创建虚拟网卡(网卡别名)的方法

    由于业务需要,要在单个物理网卡上建立多个虚拟网卡,操作如下:cd /etc/sysconfig/network-scripts/   #进入网卡目录cp ifcfg-eth0 ifcfg-eth0:1   # 复制出ifcfg-eth0:1虚拟网卡vim ifcfg-eth0:1    #配置ifcfg-eth0:1虚…

    Linux干货 2016-09-06
  • rpm实现LAMP

    rpm实现LAMP部署 LAMP概述 LAMP指的Linux(操作系统)、ApacheHTTP 服务器,MySQL(有时也指MariaDB,数据库软件) 和PHP(有时也是指Perl或Python) 的第一个字母,一般用来建立web应用平台。常用来搭建动态网站或者服务器的开源软件,本身都是各自独立的程序,但是因为常被放在一起使用,拥有了越来越高的兼容度,共同…

    Linux干货 2016-11-02