mysql表編譯 編譯方式安裝MySQL資料庫

2021-10-18 11:56:47 字數 3217 閱讀 6284

一、環境介紹:

作業系統:centos

編譯工具:cmake-2.8.8.tar

資料庫版本:mysql-5.5.32.tar

二、安裝步驟

2.1 安裝cmake工具

2.1.1 安裝c編譯器[root@oldcat_t ~]# yum install gcc –y

2.1.2 解壓並編譯安裝cmake[root@oldcat_t tools]# tar xf cmake-2.8.8.tar.gz

[root@oldcat_t tools]# cd cmake-2.8.8

[root@oldcat_t cmake-2.8.8]# ./configure

[root@oldcat_t cmake-2.8.8]# gmake

[root@oldcat_t cmake-2.8.8]# gmake install

2.1.3 檢查cmake安裝結果[root@oldcat_t cmake-2.8.8]# which cmake

/usr/local/bin/cmake

2.2 安裝mysql

2.2.1 建立mysql使用者和組[root@oldcat_t ~]# useradd mysql -s /sbin/nologin -m

[root@oldcat_t ~]# tail -1 /etc/passwd

mysql:x:501:501::/home/mysql:/sbin/nologin

2.2.2 安裝依賴包ncurses-deve[root@oldcat_t cmake-2.8.8]# yum install ncurses-devel -y

2.2.3 解壓並編譯安裝mysql[root@oldcat_t tools]# tar xf mysql-5.5.32.tar.gz

[root@oldcat_t tools]# cd mysql-5.5.32

-ddefault_charset=utf8 \

-ddefault_collation=utf8_general_ci \

-dextra_charsets=all \

-denabled_local_infile=on \

-dwith_innobase_storage_engine=1 \

-dwith_federated_storage_engine=1 \

-dwith_blackhole_storage_engine=1 \

-dwith_example_storage_engine=1 \

-dwith_partition_storage_engine=1 \

-dwith_fast_mutexes=1 \

-dwith_zlib=bundled \

-denabled_local_infile=1 \

-dwith_readline=1 \

-dwith_embedded_server=1 \

-dwith_debug=0

[root@oldcat_t mysql-5.5.32]# make

[root@oldcat_t mysql-5.5.32]# make install

注意:如果在網頁上直接複製以上引數,可能會自動在-dwith之間增加空格,必須手工去除空格才會正常執行!

2.3 配置mysql資料庫

[root@oldcat_t ~]# chmod -r 1777 /tmp

[root@oldcat_t ~]# chown mysql.mysql /etc/init.d/mysqld

[root@oldcat_t ~]# ll /etc/init.d/mysqld

-rwxr-xr-x. 1 mysql mysql 10934 12月  1 08:12 /etc/init.d/mysqld

[root@oldcat_t scripts]# ls

mysql_install_db

installing mysql system tables...

okfilling help tables...

ok......此處省略

[root@oldcat_t scripts]# . /etc/profile

[root@oldcat_t scripts]# tail -1 /etc/profile

2.3.6 啟動mysql資料庫[root@oldcat_t ~]# /etc/init.d/mysqld start

starting mysql.. success!

[root@oldcat_t ~]# netstat -lntup|grep 330*

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   listen      23166/mysqld

[root@oldcat_t ~]# lsof -i :3306

command   pid  user   fd   type device size/off node name

mysqld  23166 mysql   10u  ipv4  79990      0t0  tcp *:mysql (listen)

2.3.7 登入mysql資料庫[root@oldcat_t ~]# mysql

welcome to the mysql monitor.  commands end with ; or \g.

your mysql connection id is 32

server version: 5.5.32 source distribution

oracle is a registered trademark of oracle corporation and/or its

affiliates. other names may be trademarks of their respective

owners.

type 'help;' or '\h' for help. type '\c' to clear the current input statement.

mysql> show databases;

| database           |

| information_schema |

| mysql              |

| performance_schema |

| test               |

4 rows in set (0.00 sec)

mysql編譯方式安裝

上傳cmake 2.8.8.tar.gz到opt下,解壓tar xf cmake 2.8.8.tar.gz。這是由於最小化安裝centos後,沒有安裝cc編譯器,因此yum install gcc yum install gcc c 再次執行.configure成功。執行gmake,gmake in...

mysql 編譯 MySQL 編譯安裝

1 安裝思路解壓 tar 生成 configure cmake 編譯 make 安裝 make install 5.5版本之前 tar configure make make install 5.5版本之後 cmake gmake 2 安裝mysql cmake 定製功能 儲存引擎 字符集 壓縮 定...

mysql編譯安裝原理 MySQL編譯安裝全過程

環境介紹 安裝 lrzsz 軟體,這個軟體和編譯安裝 mysql 無關,只是為了方便後面通過 xshell 拖拽其他軟體 yum y install lrzsz 安裝 mysql 需要的各種依賴包 yum y install ncurses devel libaio devel 建立 home yu...