0.下載源碼略(最好下載帶boost那個(gè))
1.安裝工具:sudo apt-get install gcc-4.8, g++4.8,cpp-4.8, cmake
2.安裝依賴包:sudo apt-get install openssl libssl-dev libncurses5-dev bison
3.添加用戶:?groupadd mysql; useradd -r -g mysql -s /bin/false mysql
4.cd mysql-VERSION; mkdir bld; cd bld
5. cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_BOOST=../boost -DCMAKE_INSTALL_PREFIX=/opt/mysql
(我需要打開debug調(diào)試功能,你也許不需要就去掉前面的Debug, ps 可以用cmake .. -LAH查看所有支持選項(xiàng))
注意,有時(shí)候裝了依賴庫后還會(huì)莫名報(bào)錯(cuò),只要 rm CMakeCache.txt后重新cmake就能過去
6.? make -j 4
7. make install? (/opt/mysql要先解決好權(quán)限)
簡單配置文件(可以放在/etc/my.cnf或者$HOME/.my.cnf)如下:
[client]
socket = /tmp/mysql.sock
[mysqld]
user = mysql
socket = /tmp/mysql.sock
basedir = /opt/mysql
datadir = /home/mysql/data
log-error = error.log
server-id = 3306
按以上建立目錄/home/mysql/data
$/opt/mysql/bin/mysqld --initialize-insecure
$ /opt/mysql/bin/mysqld_safe &
客戶端連接:? mysql -u root -h localhost -p
關(guān)閉數(shù)據(jù)庫: mysqladmin -u root -h localhost -p shutdown