mysql原始碼包多大 MYSQL原始碼安裝

2021-10-17 13:38:02 字數 3413 閱讀 6659

[root@db02 ~]# wget

2.安裝依賴

[root@db02 ~]# yum install -y ncurses-devel libaio-devel gcc gcc-c++ glibc cmake autoconf openssl openssl-devel`

3.解壓安裝包

[root@db02 ~]# tar xf mysql-5.6.46.tar.gz

4.生成

[root@db02 ~]# cd mysql-5.6.46/

[root@db02 mysql-5.6.46]# cmake . -dcmake_install_prefix=/usr/local/mysql-5.6.46 \

-dmysql_datadir=/usr/local/mysql-5.6.46/data \

-dmysql_unix_addr=/usr/local/mysql-5.6.46/tmp/mysql.sock \

-ddefault_charset=utf8 \

-ddefault_collation=utf8_general_ci \

-dwith_extra_charsets=all \

-dwith_innobase_storage_engine=1 \

-dwith_federated_storage_engine=1 \

-dwith_blackhole_storage_engine=1 \

-dwithout_example_storage_engine=1 \

-dwith_zlib=bundled \

-dwith_ssl=system \

-denabled_local_infile=1 \

-dwith_embedded_server=1 \

-denable_downloads=1 \

-dwith_debug=0

######安裝報錯,再次執行cmake時,需要把cmakecache.txt 這個檔案刪除!!!

5.編譯安裝

[root@db02 mysql-5.6.46]# make && make install

6.軟連線

[root@db02 ~]# ln -s /usr/local/mysql-5.6.46 /usr/local/mysql

7.建立使用者

[root@db02 ~]# useradd mysql -s /sbin/nologin -m

8.拷貝配置檔案和啟動指令碼

[root@db02 ~]# cd /usr/local/mysql/support-files/

[root@db02 support-files]# cp my-default.cnf /etc/my.cnf

cp: overwrite '/etc/my.cnf'? y

[root@db02 support-files]# cp mysql.server /etc/init.d/mysqld

9.初始化資料庫

[root@db02 support-files]# cd /usr/local/mysql/scripts/

[root@db02 scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

10.system管理mysql

[root@db02 scripts]# vim /usr/lib/systemd/system/mysqld.service

[unit]

description=mysql server

documentation=man:mysqld(8)

documentation=

after=network.target

after=syslog.target

[install]

wantedby=multi-user.target

[service]

user=mysql

group=mysql

execstart=/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf

limitnofile = 5000

[root@db02 scripts]# systemctl daemon-reload

[root@db02 scripts]# systemctl start mysqld

11.啟動失敗報錯

[root@db02 scripts]# /etc/init.d/mysqld start

starting mysql.logging to '/usr/local/mysql-5.6.46/data/db02.err'.

200709 15:42:14 mysqld_safe directory '/usr/local/mysql-5.6.46/tmp' for unix socket file don't exists.

error! the server quit without updating pid file (/usr/local/mysql-5.6.46/data/db02.pid).

#原因:

1.cmake過程指定了socket檔案位置,實際位置不存在

2.目錄許可權不足

#解決:

[root@db02 scripts]# mkdir /usr/local/mysql-5.6.46/tmp/

[root@db02 scripts]# chown -r mysql.mysql /usr/local/mysql

[root@db02 scripts]# chown -r mysql.mysql /usr/local/mysql-5.6.46/

12.啟動資料庫

[root@db02 scripts]# systemctl start mysqld

13.配置環境變數

[root@db03 scripts]# vim /etc/profile.d/mysql.sh

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

[root@db03 mysql]# source /etc/profile

14.確認啟動

[root@m01 scripts]# ps -ef | grep mysql

mysql 12886 1 2 03:10 ? 00:00:00 /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf

root 12921 10636 0 03:11 pts/1 00:00:00 grep --color=auto mysql

[root@m01 scripts]# netstat -lntp

tcp6 0 0 :::3306 :::* listen 12886/mysqld

mysql原始碼包多大 MySQL原始碼包安裝

root node2 groupadd g 27 mysql root node2 useradd u 27 mysql g mysql s sbin nologin root node2 yum y install make cmake bison gcc c cmake ncurses ncur...

mysql原始碼包安裝 適用於多個mysql

yum list grep ncurses devel yum y install make gcc c cmake bison devel ncurses devel wget tar zxvf mysql 5.6.35.tar.gz cd mysql 5.6.35 mkdir p usr loc...

原始碼包安裝mysql 原始碼包安裝MySQL

mysql安裝方式 1.二進位制安裝2.原始碼包安裝3.rpm包安裝 一.原始碼包安裝 原始碼包安裝比較繁瑣,但是更加靈活,可以按自己需求配置 root db03 wget 2.安裝需要的依賴包 root db03 yum install y ncurses devel libaio devel g...