1. 程式人生 > >基於 Linux 安裝glibc版mysql 5.7.12

基於 Linux 安裝glibc版mysql 5.7.12

對於mysql的資料庫的安裝,我們有很多種選擇來完成。而最為常用的為二進位制安裝以及原始碼安裝。二進位制安裝方式中,包括rpm版本以及glibc版本。rpm版本就是在特定linux版本下編譯的,如果你的linux版本匹配,就可以安裝,如針對RedHat6或者RedHat7編譯好的rpm包,下載對應的安裝即可。還有另外一種二進位制安裝包為基於特定的glibc版本編譯的,本文主要描述基於glibc方式安裝mysql。

一、準備安裝環境

###準備安裝介質
下載地址:http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz 
###或者使用wget方式直接下載對應的版本 # wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz # mkdir -pv /u01/app # mkdir -pv /u01/soft # mkdir -pv /u02/mysqldata # cd /u01/soft # wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz # tar -xf mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz
# ln -sv /u01/soft/mysql-5.7.12-linux-glibc2.5-x86_64 /u01/app/mysql `/u01/app/mysql' -> `/u01/soft/mysql-5.7.12-linux-glibc2.5-x86_64' ###下面新增mysql使用者 # useradd -r mysql -s /sbin/nologin # chown -R mysql:mysql /u01/app/mysql # chown -R mysql:mysql /u02/mysqldata

二、初始化mysql

###使用以下的方式來初始化
# cd /u01/app/mysql/bin
# ./mysqld --initialize --basedir=/u01/app/mysql --datadir=/u02/mysqldata --user=mysql --explicit_defaults_for_timestamp
2016-06-28T02:18:23.437852Z 0 [Warning] InnoDB: New log files created, LSN=45790 2016-06-28T02:18:23.718104Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2016-06-28T02:18:23.866501Z 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: 9731b834-3cd6-11e6-8654-fcaa14e34b30. 2016-06-28T02:18:23.896540Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2016-06-28T02:18:23.898416Z 1 [Note] A temporary password is generated for [email protected]: )%%D0pr,mU.Y # ls /u02/mysqldata/ auto.cnf client-cert.pem ibdata1 performance_schema sys ca-key.pem client-key.pem ib_logfile0 server-cert.pem ca.pem client-req.pem ib_logfile1 server-key.pem ca-req.pem ib_buffer_pool mysql server-req.pem ###從上面的結果可以看出 mysql 5.7多出了證書相關檔案,安全較5.6有較大提升 ###mysql_install_db方式初始化資料已經被廢棄 # ./mysql_install_db --basedir=/u01/app/mysql --datadir=/u02/mysqldata --user=mysql 2016-06-28 10:04:56 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize 2016-06-28 10:05:15 [WARNING] The bootstrap log isn't empty: 2016-06-28 10:05:15 [WARNING] 2016-06-28T02:04:56.688237Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead 2016-06-28T02:04:56.688654Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000) 2016-06-28T02:04:56.688657Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000) ###如上書提示,mysql_install_db方式初始化資料已經被廢棄,建議使用mysqld --initialize,同時也給出了引數限制的警告 # cp /u01/app/mysql/support-files/my-default.cnf /etc/my.cnf # cp /u01/app/mysql/support-files/mysql.server /etc/init.d/mysqld # vim /etc/my.cnf [mysqld] sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES basedir=/u01/app/mysql datadir=/u02/mysqldata user=mysql port=3306 # vim /etc/profile.d/mysql.sh export MYSQL_HOME=/u01/app/mysql export PATH=$PATH:$MYSQL_HOME/bin # source /etc/profile.d/mysql.sh # service mysqld start Starting MySQL. [ OK ]

三、配置安全選項

###使用初始化時得到的密碼配置安全選項
# /u01/app/mysql/bin/mysql_secure_installation -p)%%D0pr,mU.Y
mysql_secure_installation: [Warning] Using a password on the command line interface can be insecure.

Securing the MySQL server deployment.

The existing password for the user account root has expired. Please set a new password.

New password: 

Re-enter new password: 

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: y   ###是否校驗密碼外掛

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2  ###設定密碼策略等級
Using existing password for root.

Estimated strength of the password: 100 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : 

 ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y  ###是否移除匿名使用者
Success.

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y  ###是否關閉root遠端登陸功能
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y  ###是否移除測試資料庫
 - Dropping test database... 
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y  ###是否立即生效許可權表
Success.

All done! 

###以下為安全增強相關的部分引數

mysql> show variables like 'valid%';
+--------------------------------------+--------+
| Variable_name                        | Value  |
+--------------------------------------+--------+
| validate_password_dictionary_file    |        |
| validate_password_length             | 8      |
| validate_password_mixed_case_count   | 1      |
| validate_password_number_count       | 1      |
| validate_password_policy             | STRONG |
| validate_password_special_char_count | 1      |
+--------------------------------------+--------+

四、同一主機配置其他例項

###按上面描述的步驟建立其對應的目錄及授權後,再執行初始化
###使用新的配置檔案,如下文字示例使用的為3317
# mkdir -pv /u02/mysqldata3317
# chown -R mysql:mysql /u02/mysqldata 3317
# grep -v ^# /etc/my3317.cnf

[mysqld]
basedir=/u01/app/mysql
datadir=/u02/mysqldata3317
user=mysql
port=3317
socket=/tmp/mysql3317.sock

# cd /u01/app/mysql/bin
# ./mysqld --defaults-file=/etc/my3317.cnf --initialize --user=mysql --explicit_defaults_for_timestamp
# 2016-06-30T08:32:52.497519Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-06-30T08:32:52.852457Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-06-30T08:32:53.042621Z 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: 3cb1686d-3e9d-11e6-a71f-fcaa14e34b30.
2016-06-30T08:32:53.081210Z 0 [Warning] Gtid table is not ready to be used. 
Table 'mysql.gtid_executed' cannot be opened.
2016-06-30T08:32:53.082538Z 1 [Note] A temporary password is generated for [email protected]: :8#l!MCYoCNY

### Author : Leshami
### Blog   : http://blog.csdn.net/leshami

# mysqld_safe --defaults-file=/etc/my3317.cnf &
[1] 5825
2016-06-30T08:11:49.468176Z mysqld_safe Logging to '/u02/mysqldata3317/ydq4.err'.
2016-06-30T08:11:49.480379Z mysqld_safe The file /usr/local/mysql/bin/mysqld
does not exist or is not executable. Please cd to the mysql installation
directory and restart this script from there as follows:
./bin/mysqld_safe&
See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information

###如果執行mysqld_safe出現上述錯誤,可以建立軟鏈。這個地方有問題,對於安裝在非預設目錄時出現了這個問題。
# mkdir -pv /usr/local/mysql/bin/

# ln -sv /u01/app/mysql/bin/mysqld /usr/local/mysql/bin/mysqld      
"/usr/local/mysql/bin/mysqld" -> "/u01/app/mysql/bin/mysqld"

# ./mysqld_safe --defaults-file=/etc/my3317.cnf &
[1] 8287
2016-06-30T08:38:38.455961Z mysqld_safe Logging to '/u02/mysqldata3317/ydq4.err'.
2016-06-30T08:38:38.471542Z mysqld_safe Starting mysqld daemon with databases from /u02/mysqldata3317

###配置安全選項
# /u01/app/mysql/bin/mysql_secure_installation -P3317 -S /tmp/mysql3317.sock -p  

五、更多mysql安裝解除安裝參考

相關推薦

基於 Linux 安裝glibcmysql 5.7.12

對於mysql的資料庫的安裝,我們有很多種選擇來完成。而最為常用的為二進位制安裝以及原始碼安裝。二進位制安裝方式中,包括rpm版本以及glibc版本。rpm版本就是在特定linux版本下編譯的,如果你的linux版本匹配,就可以安裝,如針對RedHat6或

在aliyun主機上通過yum方式安裝PerconaMYSQL 5.7

linux aliyun mysql Aliyun主機環境:CPU:1C MEM:2G OS:centos 6.8 1、安裝percona軟件包源yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4

CentOS7下安裝mysql安裝(mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz)

1.從mysql官網下載二進位制安裝包(https://dev.mysql.com/downloads/mysql/) 2.檢查是否已經安裝了mysql或者是MariaDB,如果已經安裝,則先把安裝的解除安裝 [[email protected] software]#

Linux[Centos 6.9] Mysql 5.7.22 安裝步驟

mysql下載 http://mysql.mirrors.pair.com/Downloads/ Mysql安裝步驟: 1、檢視是否安裝mysql:  rpm -qa|grep -i mysql 如果有安裝,需要先解除安裝之前的版本 如果沒有安裝numat

mysql-5.7.12-win64綠色安裝步驟

添加 https default png pass 搜索 mysql 電腦 直接 第一步:下載綠色版MySQL; 網盤地址: 鏈接:https://pan.baidu.com/s/1iiYpc6c1xzCprW2OjaQv0Q 提取碼:ql7f 第二步:1.配置環境變量

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

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

安裝mysql 5.7.22 (win10)安裝方案

1. mysql下載(根據系統選擇對應的版本)2. 解壓檔案在%YOUR_MYSQL_HOME%/bin資料夾下建立my.ini檔案[mysql] #設定mysql客戶端預設字符集 default-character-set=utf8 [mysqld] #設定3306埠 p

linux安裝mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz(centos)

一  官網下載 mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz 目前最新為5.7.16,可以直接下載mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz, 這裡用的是5.7.12,未下載最新的,不過,安裝方

Windows 安裝解壓縮mysql-5.7.20-winx64

1、下載ZIP壓縮包 下載點這裡 —-> 官網下載 (可根據個人需求下載) 2、新增配置檔案 將下載後的ZIP解壓到一個目錄(提示:無論什麼開發軟體安裝路徑儘量不要有中文和空格) 我這裡解壓後的目錄是: C:\Program Files\

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

CentOS 6 5安裝MySQL 5 7 12,使用官網下載的rpm安裝

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

Ubuntu 使用tar包 安裝及配置 mysql 5.7

安裝 裝更新軟體 sudo apt-get install libaio1 配置 sudo dpkg-preconfigure mysql-community-server_*.deb 在這一步會出現一個UI頁面,讓你輸入資料庫r

yum安裝最新的MySQL 5.7

1.修改yum倉庫 去這裡找到你linux版本對應的包:http://dev.mysql.com/downloads/repo/yum/ 找到對應的版本後可以直接點選右側的”Download”按鈕下載,然後手動上傳到你的伺服器上。 比如包名為:mysq

JDBC——Mysql 5.7綠色配置安裝過程

5.6 配置文件 mov 新版 否則 download 查看系統 管理員 then 前言: JDBC是Java鏈接數據庫總要接口; 學習JDBC之前最重要的是要配置好數據庫(Mysql); 以下是配置Mysql步驟; 本章大體分為 下載 和 配置安裝過程

linux安裝mysql-5.7.16

unit sda etc tro tables rac 用戶密碼 username force 1.解壓tar -xvf mysql的包 tar -xvf mysql-5.7.16-1.el6.x86_64.rpm-bundle.tar(mysql 官網中即可找到)2.

centos 7.3 安裝 mysql-5.7.18-linux-glibc2.5-x86_64

centos 7.3 安裝 mysql5.7 下載地址 :https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz 大概有600M 可以選擇迅雷下載然後進行上傳 ,因為是內網

mysql-5.7.13-winx64 免安裝配置方法

comm 免密 install 免密碼登錄 命令 logs detail itl target 1.下載MySQL Community Server 5.7.13 解壓MySQL壓縮包 2.修改 my-default.ini skip-grant-

Linux下CenOS系統 安裝Mysql-5.7.19

roo img .rpm undle -1 -c style root ima 1.輸入網址https://www.mysql.com/downloads/,進入downloads,選擇Community 2.選擇對應的版本和系統;

mysql-5.7.19免安裝的配置方法

show 找到 char conn window 文件 move 數據庫 剛才 1. 下載MySQL Community Server 5.6.13 2. 解壓MySQL壓縮包 將以下載的MySQL壓縮包解壓到自定義目錄下,我的解壓目錄是: "D:\

linux 7.4 采用RPM安裝mysql-5.7.20

ja1、下載:https://dev.mysql.com/downloads/mysql/選擇MySQL Community Server 5.7.20--> Red Hat Enterprise Linux/Oracle Linux--> RPM Bundle -->mysql-5.7