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

相關文章
相關標籤/搜索