1. 程式人生 > >mysql 5.7.14 二進位制版本詳細安裝過程

mysql 5.7.14 二進位制版本詳細安裝過程

安裝環境:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise

安裝版本

       mysql5.7.7及以上做了很多改變,5.7.7以前安裝方法和以前差不多,初始化也保留了mysql_install_db,5.7.7以後則去掉了該指令碼,使用了-initialize 或者 --initialize-insecure 引數作為初始化。

      mysql5.7.14版本初始化時候已經拋棄了defaults-file引數檔案,所以在初始化時候指定配置檔案會出錯,同時必須保證datadir為空。

網上很多安裝文章都沒指定basedir和datadir,以及如何指定自己的配置檔案進行多例項安裝,本文將是完全個性化安裝。

一、初始化

先看看幾個錯誤的初始化:

1.1 指定引數defaults-file

mysql-5.7.14#bin/mysqld --defaults-file=/data/mysql_root/data/3307/my.cnf --initialize --datadir=/data/mysql_root/data/3307/my.cnf --basedir=/data/mysql_root/mysql-5.7.14 --user=mysql
 2016-08-23T03:16:00.406283Z 0 [Warning] InnoDB: New log files created, LSN=45790 

2016-08-23T03:16:00.406283Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 

2016-08-23T03:16:00.406283Z 0 [ERROR] unknown variable ‘defaults-file=/data/mysql_root/data/3307/my.cnf’ 
2016-08-23T03:16:00.406283Z 0 [ERROR] Aborting

提示未知引數

1.2 去掉該引數指定

/mysql-5.7.14# bin/mysqld --initialize --datadir=/data/mysql_root/data/3308/ --basedir=/data/mysql_root/mysql-5.7.14/ --user=mysql 
2016-08-23T04:21:57.860613Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2016-08-23T04:21:57.861941Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2016-08-23T04:21:57.861958Z 0 [ERROR] Aborting
提示目錄已經存在;

1.3 去掉所有引數指定

mysql-5.7.14# bin/mysqld --initialize-insecure --user=mysql 
mysqld: Can't create directory '/usr/local/mysql/data/' (Errcode: 2 - No such file or directory)
2016-08-23T03:16:00.406283Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-08-23T03:16:00.406382Z 0 [ERROR] Can't find error-message file '/usr/local/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2016-08-23T03:16:00.407050Z 0 [ERROR] Aborting
錯誤:提示目錄不存在,因為我的mysql目錄是在data/mysql_root/mysql5.7.14下。

1.4 指定資料目錄和basedir

mysql-5.7.14# bin/mysqld --initialize-insecure--user=mysql --basedir=/data/mysql_root/mysql-5.7.14 --datadir=/data/mysql_root/data/3307/
2016-08-23T03:23:52.819389Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-08-23T03:23:52.931185Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-08-23T03:23:52.951819Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-08-23T03:23:53.005317Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 0446b9e5-68e1-11e6-9405-14187751620e.
2016-08-23T03:23:53.005801Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-08-23T03:23:53.006157Z 1 [Warning] [email protected] is created with an empty password ! Please consider switching off the --initialize-insecure option.

    初始化成功了。這裡說明下,初始化引數我使用了--initialize-insecure,這樣不會設定初始化root密碼,如果是--initialize的話,會隨機生成一個密碼:

2016-08-23T02:51:45.922520Z 1 [Note] A temporary password is generated for [email protected]: fhbsPu?G0PhU

我們看下mysqld的幫助:

/mysql-5.7.14# bin/mysqld --verbose --help | more
...
bin/mysqld  Ver 5.7.14 for linux-glibc2.5 on x86_64 (MySQL Community Server (GPL))
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Starts the MySQL database server.


Usage: bin/mysqld [OPTIONS]


Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf 
The following groups are read: mysqld server mysqld-5.7
The following options may be given as the first argument:
--print-defaults        Print the program argument list and exit.
--no-defaults           Don't read default options from any option file,
                        except for login file.
--defaults-file=#       Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.
--defaults-group-suffix=#
                        Also read groups with concat(group, suffix)
--login-path=#          Read this path from the login file.
...

二、啟動mysql例項

初始化完成後,就開始準備啟動,啟動還保持著原來的方式,可以使用mysqld_safe啟動,所以引數基本差不多。

需要注意的是mysql5.7開始很多引數已經做了調整,配置檔案中調整過的引數不能再使用,否則啟動會報錯。

啟動錯誤:

bin/mysqld_safe --defaults-file=/data1/mysql_root/data/3306/my.cnf --basedir=/data1/mysql_root/mysql-5.6.29 --datadir=/data1/mysql_root/data/3306/ --user=mysql

2016-08-23T03:27:56.348529Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160823 11:27:56
2016-08-23T03:27:56.348614Z 0 [ERROR] unknown variable 'tmp_table_open_size=500M'
2016-08-23T03:27:56.348623Z 0 [ERROR] Aborting

===========================================
2016-08-23T03:19:24.599885Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2016-08-23T03:19:24.600007Z 0 [ERROR] unknown variable 'thread_concurrency=4'
2016-08-23T03:19:24.600014Z 0 [ERROR] Aborting
.....
這裡大家可以根據自己啟動時候檢視錯誤日誌的錯誤進行調整;

去掉這些錯誤後,使用

bin/mysqld_safe --defaults-file=/data1/mysql_root/data/3306/my.cnf --basedir=/data1/mysql_root/mysql-5.6.29 --datadir=/data1/mysql_root/data/3306/ --user=mysql &

啟動即可。

三、登入

初始化時候使用的--initialize-insecure引數,不會隨機生成密碼,登入和原來一樣。

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

可以看到比原來多了個sys庫。

mysql5.7有做較多的改變和更新,後續有文章再繼續寫5.7的其它細節。

相關推薦

mysql 5.7.14 二進位制版本詳細安裝過程

安裝環境: DISTRIB_ID=Ubuntu DISTRIB_RELEASE=12.04 DISTRIB_CODENAME=precise 安裝版本        mysql5.7.7及以上做了很多改變,5.7.7以前安裝方法和以前差不多,初始化也保留了mysql_in

MySQL 5.7.10最新版本原始碼安裝詳細過程

1,下載地址:可以wget下載,也可以在pc本地網頁上下載完再遠端傳到linux上面去。 文件乾貨在這裡:# Preconfiguration setupshell> groupadd mysqlshell> useradd -r -gmysql -s /bin/

MySQL 5.7.18 zip版本安裝使用方法

系統服務 系統 javascrip sta idt sse assets ini文件 mark MySQL 5.7.18 zip版本的安裝使用方法 這個版本的MySQL不像那種點擊就可以立即安裝,一直下一步就OK的,這個需要自己進行配置,雖然有點小麻煩,我還是比較喜歡使用

MySQL 5.7.10最新版本號源碼安裝具體過程

ngs htm org ear xpl can 數據文件 private which 1,下載地址:安裝包下載地址:http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.10.tar.gz能夠wget下載,也能夠在p

源碼編譯安裝mysql-5.7.14

padding 默認 oar def 預編譯 err clipboard back .tar.gz 1.下載並上傳 mysql-5.7.14.tar.gz view plain copytar -zxf msql-5.7.14.tar.gz 2.安裝依賴包 view pl

Mac下mysql 5.7.14壓縮包安裝

前言:寫個紀錄,免得倒黴又重新踩坑 MySql下載 網址: http://dev.mysql.com/downloads/mysql/,這個地址最下面選擇一個點選其右側Download按鈕即可下載這裡喔只針對tar.gz包 點

mysql-5.7.12-win64綠色版安裝步驟詳細圖文教程

第一步:下載綠色版MySQL; 網盤地址: 連結:https://pan.baidu.com/s/1iiYpc6c1xzCprW2OjaQv0Q 提取碼:ql7f 第二步:1.配置環境變數 我的電腦->屬性->高階->環境變數   當然,不配置MYSQL_HO

mysql 5.7.14 資料夾安裝服務嚮導

在不同的網站中下載mysql的安裝包,但是現在下來之後發現沒有安裝程式的檔案,此時,我們應該怎麼處理呢? 寫下自己的安裝步驟,分享一下 1, 開啟資料夾,看到如下檔案目錄,發現沒有data的資料夾,

mysql 5.7.14+ 版本更改密碼, 原來user表的password程式設計了authentication_string

1、首先停止正在執行的MySQL程序 Linux下,執行 killall -TERM MySQLd Windows下,如果寫成服務的 可以執行:net stop MySQL,如未載入為服務,可直接在程序管理器中進行關閉。 2、以安全模式啟動MySQL Linux

linux安裝mysql 5.7.23二進位制 安裝jdk tomcat

` 檢視系統額外安裝軟體目錄 df -h /opt 1、安裝jdk配置java環境變數 進入目錄 cd /opt 檢視目錄屬性 ls -l 解壓jdk到當前目錄 tar -zxvf jdk-8u181-linux-x64.tar.gz 設定環境變數 vi /e

MySQL 5.7.18 在centos下安裝記錄

iba entos tool 鏈接 ready res data vim mysq 一個朋友找我如何在Linux下安裝mysql5.7.18,我稍微整理下了下記錄,如下: 下載地址: MySQL5.7.18參數官方網址:https://dev.mysql.com/doc/r

mysql 5.7.20解壓版安裝配置

conn 搜索 解壓縮 win 登陸用戶 toolbar 搜索欄 顯示 title 下載地址為: https://dev.mysql.com/downloads/mysql/ 最下面根據自己的操作系統選擇合適的型號 下載完以後解壓縮到自定義的路徑。這裏註意的是

mysql 5.7.12二進制安裝

chan linux net red open soft xtend hdp chown 1.my.cnf配置文件參數:vim /etc/my.cnf [client] port = 3306 socket = /tmp/mysq

mysql-5.7.21 二進制安裝 | Jemalloc內存優化 | 備份恢復|修改密碼

isolation max ali break edi limit ola lower mysql- 簡介 ######數據庫目錄/usr/local/mysql############ ######數據目錄/data/mysql############ ######慢日誌

mysql 5.7配置項最詳細的解釋

重新 _for 必須 請求響應 repos 索引 character 一秒 binlog日誌 配置樣例 首先提供一個我使用的配置樣例 [client] #password=88888888 socket=/data/var/mysql/mysql.sock

mysql-5.6.x和mysql-5.7.x二進制安裝

mysql#!/bin/bash#__Author__:Allen_Jol at 2018-03-21 13:52:13#Description: install mysql-5.6.39 or mysql-5.7.21 binary for centos 6.xCPUINFO=`cat /proc/cpui

mysql 5.7.21 二進制安裝

MySQL1. 說明適用於CentOS 6.*和CentOS 7.* 系統版本:CentOS 6.8_x86-64 mysql版本:mysql-5.7.21-linux-glibc2.5-x86_64.tar.gz mysql程序安裝路徑:/data/mysql mysql數據存放路徑:/data/m

MySQL 5.7.22 二進制安裝

錯誤 case ble 最大 thread ice ive 打開 hash MySQL 5.7.22 二進制安裝 一、到官網下載mysql-5.7.22二進制包 二、創建mysql用戶: useradd mysql -s /sbin/nologin -M 三

mysql-5.7.23-el7-x86_64.tar安裝配置

sha link dia x86 tar skip import tps iba 下載安裝包:https://dev.mysql.com/downloads/mysql/ 下載好後,解壓,我這裏把mysql-5.7.23-el7-x86_64.tar 改名成了mysql

mysql-5.7.23源碼編譯安裝

-c mpat ora else temporary 文件 cte name remove mysql-5.7.23源碼編譯安裝 1.下載源碼 # wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.23.ta