免編譯方式安裝MySQL-5.6.14

來源:互聯網
上載者:User

今天領導要求使用免編譯的方式安裝生產環境的mysql,所以才有了下文.  裡面涉及的目錄已經處理,大家根據需要自己來改吧!

1  下載mysql免編譯包:
1 wget http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz

2  設定mysql目錄:
tar -zxvf mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.6.14-linux-glibc2.5-x86_64 /usr/local/mysql
groupadd mysql
useradd -g mysql -M mysql
mkdir -p /work/mysql/data
chown -R mysql.mysql /work/mysql/data

3  初始化MySQL資料庫:

#提示:運行下面的命令初始化安裝mysql之前確認系統沒有/etc/my.cnf
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/work/mysql/data --user=mysql

 
4  添加mysqld 成為系統服務並設定自啟動:
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on

5  啟動mysql:
/etc/init.d/mysqld start

6  設定密碼:
/usr/local/mysql/bin/mysqladmin -u root password '你的密碼'

7  關於my.cnf:
mysqld-5.5以上版本的my.cnf這個檔案 在執行初始化的時候,會自動安裝到/usr/local/mysql/my.cnf下。  並且主要修改裡面的選項配置

 
8  故障:
Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

 
解決辦法:
這個問題是需要重新初始化mysql資料庫
mysql_install_db --basedir=/usr/local/mysql --datadir=/work/mysql/data --user=mysql

9  關於我的my.cnf:
/usr/local/mysql/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[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/local/mysql
datadir = /work/mysql/data
port = 3306
# server_id = .....
socket = /tmp/mysql.sock
# 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 = 2M
read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

 
ps : 根據上面的內容可以自己做成一鍵安裝指令碼。這樣就不必像以前那樣漫長的等待了.

RHEL 6.4(i386)安裝MySQL 5.6的方法

Linux網站架構系列之Apache----部署篇

MySQL完整安裝和主從雙機配置

RHEL6平台rpm方式安裝MySQL資料庫

RedHat 6.3安裝MySQL-server-5.6.13-1.el6.x86_64.rpm

Ubuntu 12.04下原始碼安裝MySQL5.6以及Python-MySQLdb

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.