CentOS 6.5 平台離線編譯安裝 MySQL 5.6.22

來源:互聯網
上載者:User

CentOS 6.5 平台離線編譯安裝 MySQL 5.6.22

在CentOS 6.5 平台離線編譯安裝 MySQL 5.6.22過程記錄。

一、下載源碼包

http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.22.tar.gz

二、準備工作

卸載之前本機內建的MYSQL

安裝 cmake,編譯MYSQL 的工具

yum install cmake

三、解壓源碼包

tar -zxv -f mysql-5.6.16.tar.gz 
cd mysql-5.6.16

四、CMake編譯

cmake \ 
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ 
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \ 
-DDEFAULT_CHARSET=utf8 \ 
-DDEFAULT_COLLATION=utf8_general_ci \ 
-DWITH_INNOBASE_STORAGE_ENGINE=1 \ 
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \ 
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ 
-DMYSQL_DATADIR=/jbdata/mysqldb \ 
-DMYSQL_TCP_PORT=3306 \ 
-DENABLE_DOWNLOADS=1 

註:重新回合組態,需要刪除CMakeCache.txt檔案

執行make
make

安裝
make install

五、初始化 mysql 資料庫

cd /usr/local/mysql 
scripts/mysql_install_db --user=mysql --datadir=/data/mysqldb 

六、複製開機檔案

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf 

七、複製服務啟動指令碼及加入PATH路徑

cp support-files/mysql.server /etc/init.d/mysqld

修改PATH環境變數,讓系統可以直接使用mysql的相關命令。

#vim /etc/profile.d/mysql.sh

export PATH=$PATH:/usr/local/mysql/bin

-------------------------------------------------------------------------------------
vim /etc/profile 
 
      PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH 
 
      export PATH 
 
source /etc/profile 

八、啟動mysql並加入開機啟動

service mysqld start
chkconfig --level 35 mysqld on

九、檢查mysql是否啟動

netstat -tulnp | grep 3306 
mysql -u root -p 

十、設定mysql密碼

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password'
  ./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:

./bin/mysql_secure_installation

如有興趣,也可以看看這篇文章:

Linux下MySQL 5.6.23安裝 

以下是小編為您精心挑選的MySQL相關內容,看看是否有所協助:

CentOS 7下源碼安裝MySQL 5.6 

MySQL5.7.3.0安裝配置圖解教程

Ubuntu 14.04下安裝MySQL

《MySQL權威指南(原書第2版)》清晰中文掃描版 PDF

Ubuntu 14.04 LTS 安裝 LNMP Nginx\PHP5 (PHP-FPM)\MySQL

Ubuntu 14.04下搭建MySQL主從伺服器

Ubuntu 12.04 LTS 構建高可用分布式 MySQL 叢集

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

MySQL-5.5.38通用二進位安裝

--------------------------------------分割線 --------------------------------------

相關文章

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.