mysql5.7二进制包安装

mysql5.7二进制包安装

shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql  (创建软连接)
shell> cd mysql ##如没有data目录,自建
shell> mkdir mysql-files
shell> chmod 770 mysql-files
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql #Before MySQL 5.7.6
shell> bin/mysqld --initialize --user=mysql #MySQL 5.7.6 and up
shell> bin/mysql_ssl_rsa_setup #MySQL 5.7.6 and up
shell> chown -R root .
shell> chown -R mysql data mysql-files
shell> bin/mysqld_safe --user=mysql &mysql

或者 指定配置文件启动sql

./bin/mysqld --defaults-file=/usr/local/mysql-5.7.11/support-files/my.cnf --basedir=/usr/local/mysql-5.7.11 --datadir=/usr/local/mysql-5.7.11/data --user=rootshell

 

my.cnf  内容文件以下:bash

*************************************************************************socket

basedir = /usr/local/mysql-5.7.11spa

datadir = /usr/local/mysql-5.7.11/data.net

port = 3306server

server_id = 1blog

socket = /tmp/mysql.sockssl

**************************************************************************

 

update mysql.user set authentication_string=password('root') where user='root' ;

FLUSH PRIVILEGES;

 

随系统开机启动、关闭

一、先建立 mysql-startup.sh 脚本文件, 内容以下

!/bin/bash

DEPLOY_DIR=`pwd`

/usr/local/mysql-5.7.11/bin/mysqld --defaults-file=/usr/local/mysql-5.7.11/support-files/my.cnf --user=root

echo $DEPLOY_DIR

 

二、设置mysql-startup.sh  脚本文件,开机启动便可 

      具体方法   参照 http://my.oschina.net/u/2605948/blog/666975

相关文章
相关标签/搜索