mysql5 6編譯安裝

2021-10-06 12:00:00 字數 4102 閱讀 4717

# 工具

yum -y install gcc

yum -y install gcc-c++

yum -y install make

yum -y install cmake (注:mysql 5.5後不再使用 ./configure 改用 cmake 編譯工具)

//wget 

;tar -zxf cmake-3.1.1.tar.gz;./bootstrap;make;make install

yum -y install autoconf    生成makefile檔案

# 依賴

yum -y install libtool-ltdl-devel    libtool依賴檢查

yum -y install freetype-devel

yum -y install libxml2-devel    xml擴充套件

yum -y install gd-devel    gd庫

yum -y install libjpeg-devel

yum -y install libpng-devel

yum -y install openssl openssl-devel

yum -y install curl-devel

yum -y install patch

yum -y install unzip    zip解壓縮

yum -y install epel-release    

提供額外的包 

yum -y install libmcrypt-devel    

加密庫yum -y install libmhash-devel    

加密庫yum -y install ncurses-devel    

mysql 控制終端顯示的庫檔案

yum -y install sudo

yum -y install bzip2    

.bz2壓縮

yum -y install flex        詞法

分析器yum -y install bison bison-devel    語法

分析器yum -y install libaio-devel    

非同步io

yum -y install glibc

# 編譯

wget 

tar -zxf mysql-5.6.48.tar.gz

cd mysql-5.6.48/

cmake . -dcmake_install_prefix=/usr/local/mysql \    安裝位置

-dmysql_datadir=/usr/local/mysql/data \    資料目錄

-dmysql_unix_addr=/usr/local/mysql/mysql.sock \    套接字

-ddefault_charset=utf8 \    預設字符集

-ddefault_collation=utf8_general_ci \    預設

校對字符集

-dwith_extra_charsets=all \    擴充套件字符集

-dwith_innobase_storage_engine=1 \    innodb 引擎

-dwith_federated_storage_engine=1 \  ??

-dwith_blackhole_storage_engine=1 \ ??

-dwithout_example_storage_engine=1 \ ??

-dwith_zlib=system\    bundled:坑死

-dwith_ssl=system\    bundled:坑死

-denabled_local_infile=1 \

-dwith_embedded_server=1 \

-denable_downloads=1 \

-dwith_debug=0

//預設

//-dwith_myisam_storage_engine=1 \   myisam 引擎

//-dwith_memory_storage_engine=1 \ memory 引擎

//-dwith_readline=1 \    readline 庫

//-dmysql_user=mysql \    使用者

//-dmysql_tcp_port=3306 \    埠

make

make install

# 初始化

/usr/sbin/groupadd mysql

/usr/sbin/useradd -g mysql mysql

cp support-files/my-default.cnf /etc/my.cnf

/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --no-defaults--user=mysql

chown -r mysql:mysql /usr/local/mysql/

cp support-files/mysql.server /etc/init.d/mysqld    啟動指令碼

chmod +x /etc/init.d/mysqld

/etc/init.d/mysqld start     淚奔:starting mysql.. success!        錯誤日誌:vim /usr/local/mysql/data/centos-linux.shared.err

ln -s /usr/local/mysql/bin/* /usr/bin/

chkconfig --add mysqld;chkconfig --level 35 mysqld on;開機自啟;

/etc/init.d/mysqld start

service mysqld start

# 預設密碼

/usr/local/mysql/bin/mysqld_safe --skip-grant-tables &        &:後台執行

mysql -u root -p;

use mysql;

desc user \g;

update user set password=password("123456") where user='root』;

flush privileges;

quit

service mysql restart

# 遠端

use mysql;

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

mysql -u root -p -h 10.211.55.11

/usr/local/mysql/bin/mysqladmin-u root -h 10.211.55.11 password 'new-password'

# 自啟

cp support-files/mysql.server /etc/rc.d/init.d/mysqld

chkconfig --add mysqld

chkconfig --level 35 mysqld on

# 清理

find / -name mysql -exec rm -rf {} \;

whereis mysql -exec rm -rf {} \;

make clean

rm -f  cmakecache.txt

# 偽使用者

cat /etc/group | grep mysql

cat /etc/passwd |grep mysql

# cmake 和 configure 的區別

configure 生成:config.log + config.status

cmake 生成    :cmakefiles/cmakeerror.log + cmakefiles/cmakeoutput.log # 

幫助/usr/local/mysql/bin/mysql --help

./configure —help

mysqld --verbose --help

編譯mysql5 6 編譯安裝mysql5 6

mysqlwget tar zxvf mysql 5.6.33.tar.gz tar zxvf cmake 2.8.5.tar.gz cd cmake 2.8.5 安裝編譯工具.bootstrap prefix usr local cmake sudo gmake sudo gmake instal...

mysql5 6編譯安裝

安裝mysql5.6 安裝cmake及依賴 yum install cmake wget gcc c gcc ncurses devel git perl perl devel y centos7安裝mysql 檢查 mysql 是否已安裝 yum list installed grep mysql...

mysql5 6編譯安裝

1.新增使用者 root web01 tools useradd s sbin nologin m mysql root lb01 id mysql uid 27 mysql gid 27 mysql groups 27 mysql 2.安裝相關依賴 yum install ncurses deve...