LINUX環境下MYSQL5 5原始碼安裝

2021-06-27 20:54:31 字數 3566 閱讀 2035

首先到

2)解壓cmake

#tar -zvxf cmake-2.8.7.tar.gz

3)配置編譯

#cd cmake-2.8.7

#yum -y install gcc

#yum -y install gcc-c++

#./configure

#make

#make install

2)解壓mysql-5.5.21.tar.gz

#tar -zvxf mysql-5.5.21.tar.gz

建立資料目錄(mysql5.5預設已經沒有data目錄了)

mkdir /mysql/mysql/data

3)配置編譯

#cd mysql-5.5.21

#cmake .                             ##這個方法,安裝路徑預設 

或#cmake . \

-dcmake_build_type:string=release \

-dcmake_install_prefix:path=/mysql/mysql \

-dcommunity_build:bool=on \

-denabled_profiling:bool=on \

-denable_debug_sync:bool=off \

-dinstall_layout:string=standalone \

-dmysql_datadir:path=/mysql/mysql/data \

-dmysql_maintainer_mode:bool=off \

-dwith_embedded_server:bool=on \

-dwith_extra_charsets:string=all \

-dwith_ssl:string=bundled \

-dwith_unit_tests:bool=off \

-dwith_zlib:string=bundled \

-lh如果出現一下錯誤:

remove cmakecache.txt and rerun cmake.on debian/ubuntu, package name is libncurses5-dev, on redhat and derivates it is ncurses-devel.

call stack (most recent call first):

cmake/readline.cmake:126 (find_curses)

cmake/readline.cmake:216 (mysql_use_bundled_libedit)

cmakelists.txt:256 (mysql_check_readline)

-- configuring incomplete, errors occurred!

安裝:# yum -y install ncurses-devel

#make

#make install

#groupadd mysql

#useradd -r -g mysql mysql

#cd /mysql/mysql

#chown -r mysql:mysql .

#scripts/mysql_install_db --user=mysql 

#chown -r root .

#chown -r mysql data

#cp ./support-files/my-small.cnf ./my.cnf  

#cp support-files/mysql.server mysql; chmod +x mysql 

#chown -r mysql:root .

#./mysql start

#./bin/mysqladmin -u root password 

錯誤解決

1) ./scripts/mysql_install_db 

installing mysql system tables...

101223 14:28:49 [error] ./bin/mysqld: unknown option '--skip-locking'

101223 14:28:49 [error] aborting

101223 14:28:49 [note] ./bin/mysqld: shutdown complete

由於是以前安裝過mysql ,所以存在/etc/my.cnf,而且mysql的環境變數和現在的不一樣,

從而影響 現在的,解決方法是:rm -rf /etc/my.cnf

2 )  ./scripts/mysql_install_db --basedir/mysql/mysql/ --datadir/mysql/mysql/data/mysql  --user=mysql

檢視原因:cat data/xcw.err 

101223 15:39:18 mysqld_safe starting mysqld daemon with databases from      /w/mysqld558/data

/w/mysqld558/bin/mysqld: table 'mysql.plugin' doesn't exist

101223 15:39:18 [error] can't open the mysql.plugin table. please run  mysql_upgrade to create it.

innodb: the innodb memory heap is disabled

innodb: mutexes and rw_locks use innodb's own implementation

innodb: compressed tables use zlib 1.2.3

101223 15:39:18  innodb: using linux native aio

101223 15:39:18  innodb: initializing buffer pool, size = 128.0m

101223 15:39:18  innodb: completed initialization of buffer pool

101223 15:39:18  innodb: highest supported file format is barracuda.

101223 15:39:18  innodb: 1.1.4 started; log sequence number 1588771

101223 15:39:18 [error] //mysql/mysql/bin/mysqld: unknown option '--skip-locking'

101223 15:39:18 [error] aborting

原因同上,處理也同上

3)  啟動mysql服務時出現:

starting mysql.the server quit without updating pid file (/w/mysqld558/xcw.pid).[failed]

原因是由於data沒有設定好,解決:vi mysql : datadir=/w/mysqld558 fix to datadir=/mysql/mysql/data

大功告成!

linux環境下安裝和解除安裝Mysql5 5

學習資料參考 查詢以前是否裝有mysql rpm qa grep i mysql顯示類似如下的資訊 mysql client 5.5.25a 1.rhel5mysql server 5.5.25a 1.rhel5說明已經安裝過了停止mysql服務 刪除之前安裝的mysql刪除命令 rpm e nod...

MYSQL5 5原始碼安裝 linux下

首先安裝必要的庫 yum y install gcc 安裝 mysql 首先安裝camke 一 支援yum,則 yum install y cmake 二 也可以原始碼安裝 root localhost cd usr local src root localhost src wget root lo...

MYSQL5 5原始碼安裝 linux下

首先安裝必要的庫 yum y install gcc 安裝編譯工具 複製 安裝 mysql 首先安裝camke 一 支援yum,則 yum install y cmake 編譯工具,注意mysql5.5 mysql5.6 編譯工具是cmake 已經不是make,後面 復二 也可以原始碼安裝 cd u...