mysql5 6原始碼 mysql5 6原始碼部署

2021-10-17 12:32:38 字數 2097 閱讀 2435

一.準備環境

環境:centos-7.3 一台

軟體版本:mysql-5.6.39

1.安裝依賴

yum -y install autoconf libaio bison ncurses-devel

2.建立使用者

groupadd mysql

useradd -g mysql -s /sbin/nologin mysql

3.清理centos7 預設自帶資料庫

yum -y remove mariadb mariadb-server

二.部署

wget

2.安裝

tar -xf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz

mv mysql-5.6.39-linux-glibc2.12-x86_64 /usrlocal/mysql

mkdir /var/log/mysql

mkdir /usr/local/mysql/data

mysql即使root啟動還是mysql使用者執行的,所以要給許可權

chown -r mysql:mysql /usr/local/mysql

chown -r mysql:mysql /ops/log/mysql

3.修改配置,具體再根據效能和需求修改

vim /etc/my.cnf

[mysql]

default-character-set=utf8

socket=/usr/local/mysql/mysql.sock

[mysqld]

skip-name-resolve

port = 3306

socket=/usr/local/mysql/mysql.sock

basedir=/usr/local/mysql

datadir=/usr/local/mysql/data

max_connection=200

character-set-server=utf8

default-storage-engine=innodb

lower_case_table_name=1

max_allowed_packet=16m

log-error=/var/log/mysql/mysql.log

pid-file=/var/log/mysql/mysql.pid

bind-address = 0.0.0.0

4.啟動服務

cd /usr/local/mysql

進行初始化操作

./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/

讓mysql可以讀

chown mysql:mysql /etc/my.cnf

5.加入systemctl

vim /usr/lib/systemd/system/mysql.service

[unit]

description=mysql

after=network.target remote-fs.target nss-lookup.target

[service]

type=forking

execstart=/usr/local/mysql/support-files/mysql.server start

execreload=/usr/local/mysql/support-files/mysql.server restart

execstop=/usr/local/mysql/support-files/mysql.server stop

privatetmp=true

[install]

wantedby=multi-user.target

6.設定環境變數

echo 'path=$path':/usr/local/mysql/bin >> /etc/profile

source /etc/profile

7.登陸

systemctl start mysql

systemctl enable mysql

mysql 5 6 原始碼 mysql5 6原始碼安裝

os環境centos6.3 yum y install gcc gcc c gcc g77 autoconf automake zlib fiex libxml ncurses libmcrypt libtool ltdl devel make cmake 必要軟體包安裝 useradd mysql...

mysql5 6原始碼包 MySQL5 6原始碼包安裝

以下我們在centos7作業系統上以mysql5.6為例來進行一下安裝 環境準備 可聯網的yum源或者本地系統盤 二者任一,此步驟主要是按照編譯的必須環境,如果確定已有可跳過 開始安裝 安裝編譯環境 如果有gcc等編譯環境可跳過 yum install y make gcc ncurses deve...

MySQL 5 6原始碼安裝

1 解決依賴關係 yum y install cmake bison git ncurses devel gcc gcc c 2 進入到 usr local src cd usr local srcwget4 檢視mysql的大小 解壓 du sh mysql 5.6.39 linux glibc2...