mysql 5.6.38 安裝(redhat 6)

本文只適用於通過 rpm 二進制的方式安裝,使用源碼安裝的請自行百度。

1. 準備步驟

下載地址 :https://dev.mysql.com/downloads/mysql/5.6.html

只需要以下安裝文件

MySQL-client*.rpm
MySQL-devel*.rpm
MySQL-server*.rpm 

需要使用 root 的賬號進行操作

2. 卸載

卸載包

找出所有已經安裝的包

rpm -qa | grep -i mysql

移除上面命令列出來的包

rpm -e pagename --nodeps

參數 pagename 上面出現的包名
參數 --nodeps 表示不檢查依賴進行刪除

刪除文件

查找 mysql 的文件

find / -name mysql

刪除

rm -rf folderORFileNamw

3. 安裝

安裝軟件

依次執行

rpm -ivh MySQL-devel*.rpm
rpm -ivh MySQL-client*.rpm
rpm -ivh MySQL-server*.rpm 

此時安裝完成後 mysql 已經自動啓動。查看是否啓動成功可以使用 lsof -i:3306 來查看。

配置 my.cnf

使用命令 find / -name my-default.cnf 找到此文件。
複製配置文件到 /etc/ 目錄下

cp thisFilePath/my-default.cnf /etc/my.cnf

編輯修改 my.cnf 文件,只需要修改以下配置

 # mysql 安裝的基礎目錄
 basedir = /usr
 # mysql 數據庫文件目錄(默認目錄)
 datadir = /var/lib/mysql
 # 端口(可隨意修改)
 port = 3306
 # 大小寫忽略(用於表名、字段)
 lower_case_table_names=1

附上我的 my.cnf 配置

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
 basedir = /usr
 datadir = /var/lib/mysql
 port = 3306
# server_id = .....
# socket = .....

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
 join_buffer_size = 128M
 sort_buffer_size = 16M
# read_rnd_buffer_size = 2M
 lower_case_table_name = 1

thread_cache_size = 16 
query_cache_size = 128M
max_connections = 3000 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

5. 備註

以下爲mysql 安裝後的目錄說明

Directory Contents of Directory
/usr/bin Client programs and scripts
/usr/sbin The mysqld server
/var/lib/mysql Log files, databases
/usr/share/info Manual in Info format
/usr/share/man Unix manual pages
/usr/include/mysql Include (header) files
/usr/lib/mysql Libraries
/usr/share/mysql Miscellaneous support files, including error messages,character set files, sample configuration files, SQL for database installation
/usr/share/sql-bench Benchmarks

6. 安裝參考鏈接

http://blog.csdn.net/u010257584/article/details/51320542

mysql my.cnf 說明

文章出自 http://blog.wordty.cn

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章