原始碼方式安裝mysql 5.6.15
MySql主從安裝
1 環境介紹
作業系統:Oracle Linux Server release 6.2
2 安裝軟體
採用原始碼安裝方式
1. mysql安裝包:mysql-5.6.15.tar.gz
Mysql 下載地址:http://dev.mysql.com/downloads/
2. Cmake安裝包
mysql5.5以後是通過cmake來編譯的
wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
3 刪除Oracle Linux自帶的MySql
如果已經安裝了Mysql其他版本,先刪除
3.1 檢查是否安裝了MySQL
[root@study1 /]# rpm -qa | grep -i mysql
mysql-libs-5.1.52-1.el6_0.1.i686
qt-mysql-4.6.2-20.el6.i686
mysql-server-5.1.52-1.el6_0.1.i686
mysql-5.1.52-1.el6_0.1.i686
perl-DBD-MySQL-4.013-3.el6.i686
3.2 使用yum來刪除MySQL
[root@study1 ~]# yum -y remove mysql-server-5.1.52-1.el6_0.1.i686
[root@study1 ~]# yum -y remove mysql-5.1.52-1.el6_0.1.i686
[root@study1 ~]# yum -y remove mysql-libs-5.1.52-1.el6_0.1.i686
4 主伺服器上安裝MySql
4.1 先安裝cmake
[root@study1 software]# tar -zxvf cmake-2.8.4.tar.gz
[root@study1 software]# cd cmake-2.8.4
[root@study1 cmake-2.8.4]# ./configure
[root@study1 cmake-2.8.4]# make
[root@study1 cmake-2.8.4]# make install
4.2 建立mysql的安裝目錄及資料存放目錄
[root@study1 opt]# mkdir /opt/mysql //安裝mysql
[root@study1 opt]# mkdir /opt/mysql/data //存放資料
4.3 建立mysql使用者及使用者組
[root@study1 opt]# groupadd mysql
[root@study1 opt]# useradd –r –g mysql mysql
賦予資料存放目錄許可權:
chown mysql:mysql -R /opt/mysql/data
4.4 編譯安裝mysql
? 編譯
[root@study1 software]# tar -zxvf mysql-5.6.15.tar.gz
[root@study1 software]# cd mysql-5.6.15
[root@study1 mysql-5.6.15]# cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql \
-DSYSCONFDIR=/opt/mysql/etc \
-DMYSQL_DATADIR=/opt/mysql/data \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_SSL=bundled \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
引數說明:
CMAKE_INSTALL_PREFIX : MySQL安裝目錄
SYSCONFDIR : 配置檔案目錄
MYSQL_DATADIR :資料庫目錄
MYSQL_TCP_PORT :資料庫埠
MYSQL_UNIX_ADDR :安排個目錄放mysql.sock檔案把,可以設定為日誌存放,data存放目錄等位置
WITH_EXTRA_CHARSETS : 字元
WITH_SSL :the type of SSL
WITH_EMBEDDED_SERVER :Whether to build embedded server (預設:OFF)
ENABLED_LOCAL_INFILE :Whether to enable LOCAL for LOAD DATA INFILE(預設:OFF) 允許從本地匯入資料
WITH_INNOBASE_STORAGE_ENGINE: 1
引數詳細見:http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html
如果發生錯誤檢視:
。。。/mysql-5.6.15/CMakeFiles下的CMakeError.log、CMakeOutput.log檔案
注意事項:
重新編譯時,需要清除舊的物件檔案和快取資訊。
# rm -f CMakeCache.txt
? 安裝
[root@study1 mysql-5.6.15]# make
[root@study1 mysql-5.6.15]# make install
4.5 初始化資料庫
[root@study1 mysql]# cd /opt/mysql
[root@study1 mysql]# mkdir etc
[root@study1 mysql]# mkdir log
[root@study1 mysql]# chown -R mysql .
[root@study1 mysql]# chgrp -R mysql .
[root@study1 mysql]# scripts/mysql_install_db --user=mysql --basedir=/opt/mysql/ --datadir=/opt/mysql/data/
Installing MySQL system tables...2014-01-23 10:18:50 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-01-23 10:18:50 20209 [Note] InnoDB: The InnoDB memory heap is disabled
2014-01-23 10:18:50 20209 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-01-23 10:18:50 20209 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-01-23 10:18:50 20209 [Note] InnoDB: Using Linux native AIO
2014-01-23 10:18:50 20209 [Note] InnoDB: Not using CPU crc32 instructions
2014-01-23 10:18:50 20209 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-01-23 10:18:50 20209 [Note] InnoDB: Completed initialization of buffer pool
2014-01-23 10:18:50 20209 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2014-01-23 10:18:50 20209 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2014-01-23 10:18:50 20209 [Note] InnoDB: Database physically writes the file full: wait...
2014-01-23 10:18:50 20209 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2014-01-23 10:18:53 20209 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2014-01-23 10:18:56 20209 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2014-01-23 10:18:56 20209 [Warning] InnoDB: New log files created, LSN=45781
2014-01-23 10:18:56 20209 [Note] InnoDB: Doublewrite buffer not found: creating new
2014-01-23 10:18:56 20209 [Note] InnoDB: Doublewrite buffer created
2014-01-23 10:18:56 20209 [Note] InnoDB: 128 rollback segment(s) are active.
2014-01-23 10:18:56 20209 [Warning] InnoDB: Creating foreign key constraint system tables.
2014-01-23 10:18:56 20209 [Note] InnoDB: Foreign key constraint system tables created
2014-01-23 10:18:56 20209 [Note] InnoDB: Creating tablespace and datafile system tables.
2014-01-23 10:18:56 20209 [Note] InnoDB: Tablespace and datafile system tables created.
2014-01-23 10:18:56 20209 [Note] InnoDB: Waiting for purge to start
2014-01-23 10:18:56 20209 [Note] InnoDB: 5.6.15 started; log sequence number 0
2014-01-23 10:18:58 20209 [Note] Binlog end
2014-01-23 10:18:58 20209 [Note] InnoDB: FTS optimize thread exiting.
2014-01-23 10:18:58 20209 [Note] InnoDB: Starting shutdown...
2014-01-23 10:18:59 20209 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK
Filling help tables...2014-01-23 10:18:59 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-01-23 10:19:00 20234 [Note] InnoDB: The InnoDB memory heap is disabled
2014-01-23 10:19:00 20234 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-01-23 10:19:00 20234 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-01-23 10:19:00 20234 [Note] InnoDB: Using Linux native AIO
2014-01-23 10:19:00 20234 [Note] InnoDB: Not using CPU crc32 instructions
2014-01-23 10:19:00 20234 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-01-23 10:19:00 20234 [Note] InnoDB: Completed initialization of buffer pool
2014-01-23 10:19:00 20234 [Note] InnoDB: Highest supported file format is Barracuda.
2014-01-23 10:19:00 20234 [Note] InnoDB: 128 rollback segment(s) are active.
2014-01-23 10:19:00 20234 [Note] InnoDB: Waiting for purge to start
2014-01-23 10:19:00 20234 [Note] InnoDB: 5.6.15 started; log sequence number 1625977
2014-01-23 10:19:00 20234 [Note] Binlog end
2014-01-23 10:19:00 20234 [Note] InnoDB: FTS optimize thread exiting.
2014-01-23 10:19:00 20234 [Note] InnoDB: Starting shutdown...
2014-01-23 10:19:01 20234 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/mysql//bin/mysqladmin -u root password 'new-password'
/opt/mysql//bin/mysqladmin -u root -h study1.dlt password 'new-password'
Alternatively you can run:
/opt/mysql//bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; /opt/mysql//bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!
The latest information about MySQL is available on the web at
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /opt/mysql//my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
[root@study1 mysql]# chown -R root .
[root@study1 mysql]# chown -R mysql data
[root@study1 mysql]# bin/mysqld_safe --user=mysql &
[3] 20646
[root@study1 mysql]# 140123 10:42:05 mysqld_safe Logging to '/opt/mysql/data/study1.dlt.err'.
140123 10:42:05 mysqld_safe Starting mysqld daemon with databases from /opt/mysql/data
4.6 配置資料庫
修改密碼:
[root@study1 mysql]# bin/mysqladmin -u root password 'mysql'
[root@study1 mysql]# cp support-files/mysql.server /etc/init.d/
[root@study1 mysql]# cp support-files/my-default.cnf etc/my.cnf
編輯etc/my.cnf,zai [mysqld]下增加lower_case_table_names=1
設定環境:
[root@study1 etc]# cd /etc
[root@study1 etc]# vi profile
在檔案最後增加:
PATH=/opt/mysql/bin:/opt/mysql/lib:$PATH
export PATH
4.7 手工啟動資料庫
[root@study1 mysql]# service mysql.server status
ERROR! MySQL is not running
[root@study1 mysql]# service mysql.server start
Starting MySQL.......... SUCCESS!
[root@study1 mysql]# service mysql.server status
SUCCESS! MySQL running (31160)
[root@study1 mysql]#
4.8 設定自動啟動
[root@study1 mysql]# chkconfig --level 35 mysql.server on
[root@study1 mysql]# chkconfig | grep mysql
mysql.server 0:off 1:off 2:on 3:on 4:on 5:on 6:off
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/195110/viewspace-1074602/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 連網安裝mysql與原始碼安裝mysqlMySql原始碼
- MySQL 5.7.28 原始碼安裝MySql原始碼
- Mysql for Linux安裝配置之—— 原始碼安裝MySqlLinux原始碼
- mysql5.5.20原始碼安裝MySql原始碼
- 【轉】MySQL原始碼編譯安裝MySql原始碼編譯
- mysql之tar.gz原始碼安裝MySql原始碼
- 阿里雲mysql原始碼編譯安裝阿里MySql原始碼編譯
- Linux使用原始碼來安裝MySQL 5.7Linux原始碼MySql
- MySQL5.7.16原始碼編譯安裝MySql原始碼編譯
- MySQL 5.7.22 rpm 安裝方式MySql
- mysql8.0原始碼一鍵安裝指令碼MySql原始碼指令碼
- MYSQL5.7.22 原始碼安裝 主從搭建MySql原始碼
- MySQL所有的安裝部署方式MySql
- CentOS7.X原始碼安裝MySQL-5.7.18CentOS原始碼MySql
- CentOS7 安裝 Mysql 8:0 的yum安裝方式CentOSMySql
- Mysql5.6 for Centos6.5原始碼編譯安裝MySqlCentOS原始碼編譯
- mysql 原始碼安裝-5.7-17-19版本MySql原始碼
- nginx原始碼安裝Nginx原始碼
- 原始碼安裝postgresql原始碼SQL
- 原始碼安裝GO原始碼Go
- 原始碼安裝openresty原始碼REST
- Nginx 原始碼安裝Nginx原始碼
- 【推薦 - 原始碼安裝】nginx - 安裝原始碼Nginx
- PostgreSQL 10.12 安裝系列 - 原始碼安裝SQL原始碼
- CentOS 6.7下yum方式安裝MySQL 5.6CentOSMySql
- MYSQL5.7.22 原始碼安裝 主從搭建 + KEEPALIVED高可用MySql原始碼
- 基於Linux的MySQL5.7原始碼編譯安裝LinuxMySql原始碼編譯
- GDB 除錯 Mysql 實戰(一)原始碼編譯安裝除錯MySql原始碼編譯
- Ubuntu 16.04下 Mysql5.7.17原始碼編譯與安裝UbuntuMySql原始碼編譯
- MYSQL5.6.40原始碼安裝 主從搭建 主主搭建MySql原始碼
- linux安裝python3(原始碼安裝)LinuxPython原始碼
- yum安裝與原始碼安裝比較原始碼
- macbook 原始碼安裝 redisMac原始碼Redis
- macbook 原始碼安裝 nginxMac原始碼Nginx
- docker原始碼安裝NginxDocker原始碼Nginx
- paramiko 2.4.1原始碼安裝原始碼
- Jtti:美國Linux伺服器原始碼編譯的安裝方式JttiLinux伺服器原始碼編譯
- mysql 8 windows 版本zip方式安裝步驟MySqlWindows
- 【PG安裝】postgresql10 for linux 原始碼安裝SQLLinux原始碼