Home > Database > Mysql Tutorial > body text

02-mysql-安装_MySQL

WBOY
Release: 2016-06-01 13:07:01
Original
1036 people have browsed it
02-mysql-安装
  ----MySQL安装版本以及技术文档
     mysql目前常用版本  mysql-5.6.15.tar.gz
  


----MySQL编译安装
    1. 安装环境要求:mysql用户和组且ID为27,安装软件make,cmake,gcc,gcc-c++,ncurses-devel ,bison。 groupadd -g 27 mysqluseradd -u 27 -g mysql -s /sbin/nologin -M mysql
    2.创建安装目录/usr/local/mysql5.6  ,数据目录/database,PID目录/var/run/mysqld,日志目录/var/log/mysqld。 配置文件目录/usr/local/mysql5.6/etc    3.cmake -LH  产生CMakeCache.txt, 在make是就按这个cache文件来编译(这样全是默认,建议使用步骤4)。
    4.制定CMakeCache.txt文件
cmake /
-DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql5.6 /     指定安装路径
-DMYSQL_DATADIR:PATH=/database /                               指定数据库路径
-DSYSCONFDIR:PATH=/usr/local/mysql5.6/etc /                 指定配置文件路径
-DWITH_DEBUG:BOOL=on                                                 开启调试功能 
    5.编译软件make
    6.安装软件make install
    7.MySQL配置文件修改/usr/local/mysql5.6/etc/my.cnf
[mysqld]
basedir=/usr/local/mysql5.6
datadir=/database
socket=/var/run/mysqld/mysql5.6.sock
pid-file=/var/run/mysqld/mysql5.6.pid
port=3307      默认是3306
user=mysql
[mysqld_safe]
log-error=/var/log/mysqld/mysql5.6-error.log
    8.给各个相关目录赋予mysql权限
chown  -R  myslq.mysql      /usr/local/mysql5.6    /database    /var/run/mysqld/    /var/log/mysqld
    9.执行mysql_install_db 脚本文件
/usr/local/mysql5.6/scripts/mysql_install_db        --basedir=/usr/local/mysql5.6    --datadir=/database    --user=mysql
    10.复制启动命令文件到系统目录
cp  /usr/local/mysql5.6/support-files/mysql.server       /etc/rc.d/init.d/mysql5.6或/etc/init.d/mysqld
    11.设置开机启动mysql,和启动myslqd
chkconfig --add mysql5.6
service mysql5.6 start
    12.配置环境变量将/usr/local/mysql5u6/bin  添加到profile中
export  PATH=$PATH:/usr/local/mysql5u6/bin
    使文件生效
source /etc/profile








03-mysql-自动安装脚本

#!/bin/bash
#comment
#./mysql-5.6.sh  mysql-5.6.15.tar.gz
#:set ff=unix
#:set nobomb

name1="$1"
name2=${name1/.tar.gz
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template