mysql5.7依賴的軟體包:gcc gcc-c++ ncurses ncurses-devel bison make等供參考,安裝前可以使用rpm -qa |grep $(軟體包名)檢查
# yum install -y gcc gcc-c++ glibc automake autoconf libtool make# cd /tmp
# wget
# wget
# wget
# cd /tmp# ls
# tar -zvxf cmake-3.14.5.tar.gz
# cd cmake-3.14.5
# ./ bootstrap
# gmake && gmake install
# cd ~
# cmake -version
cmake version 3.14.5
# cd /tmp# tar xf boost_1_59_0.tar.gz -c /usr/local/
# cd /usr/local/
# mv boost_1_59_0/ boost
# cd boost/
# yum install -y gcc gcc-c++ ncurses ncurses-devel bison make# mkdir -p /database/mysql/
# tree -l 2 /database/
# useradd mysql -s /sbin/nologin -m -g mysql
# id mysql
# cd /tmp
# tar xf mysql-5.7.27.tar.gz
# cd mysql-5.7.27
# cmake . -dcmake_install_prefix=/database/mysql \
-dmysql_datadir=/database/mysql/data \
-dmysql_unix_addr=/database/mysql/tmp/mysql.sock \
-ddefault_charset=utf8 \
-ddefault_collation=utf8_general_ci \
-dextra_charsets=gbk,gb2312,utf8,ascii \
-denabled_local_infile=on \
-dwith_innobase_storage_engine=1 \
-dwith_federated_storage_engine=1 \
-dwith_zlib=bundled \
-dwith_embedded_server=1 \
-dwith_debug=0 \
-dwith_boost=/usr/local/boost
// -dwith_blackhole_storage_engine=1 \
// -dwith_partition_storage_engine=1 \
# make install
# echo 'export path=/database/mysql/bin:$path' >> /etc/profile# tail -1 /etc/profile
# source /etc/profile
# echo $path
# chown -r mysql:mysql /database/mysql/
# chown mysql:mysql /etc/my.cnf
# cp /etc/my.cnf /etc/my.cnf.bak
# vi /etc/my.cnf
[client]
port = 3306
socket = /database/mysql/tmp/mysql.sock
default-character-set = utf8
[mysqld]
port = 3306
basedir = /database/mysql
datadir = /database/mysql/data
pid-file = /database/mysql/mysqld.pid
socket = /database/mysql/tmp/mysql.sock
tmpdir = /database/mysql/tmp
character-set_server = utf8
server-id = 1
max_connections = 100
max_connect_errors = 10
log-bin = /database/mysql/binlog/mysql-bin
log-error = /database/mysql/logs/mysql_5_7_27.err
# cd /database/mysql# ./bin/mysqld --initialize-insecure --user=mysql --basedir=/database/mysql --datadir=/database/mysql/data
# cd /database/mysql/data
# chmod +r server-key.pem
# ll server-key.pem
設定初始化使用者
關閉防火牆、selinux
# cd //database/mysql# cp support-files/mysql.server /etc/init.d/mysql
# ls /etc/init.d/mysql
# systemctl deamon-reload //過載系統庫
# systemctl enable mysql
# /etc/init.d/mysql restart
# ps aux |grep mysqld
# yum install -y lsof
# lsof -i:3306
# msyql> select user,host from mysql.user; //檢視賬號
mysql.session localhost
mysql.sys localhost
root localhost
> grant all privileges on *.* to 'zhangsan'@'localhost' identified by 'ab.123com' with grant option;
> set password for 'mysql.session'@'localhost' = password('ab.123com');
> set password for 'root'@'localhost' = password('ab.123com');
> flush privileges;
# /etc/init.d/mysql stop
# /etc/init.d/mysql start
//授權遠端使用者
# mysql -uroot -p'ab.123com'
> grant all privileges on *.* to 'lisi'@'192.168.1.%' identified by 'ab.123com' with grant option;
> flush privileges;
> select user,host from mysql.user;
測試遠端登入(客戶端2;192.168.1.3)
# mysql -h192.168.1.2 -u lisi -p'ab.123com' -p3306> show database;
編譯LNMP環境
cd usr local src wget 2.tar gz2 解壓 cd usr local src tar zxvf nginx 1.10 2.tar gz3 配置 cd usr local src nginx 1.10.2 configure prefix usr local nginx 如果...
linux下編譯安裝lnmp環境
1.建立執行使用者 useradd m s sbin nologin mysql 新建程式使用者並加入mysql組,不允許登陸系統 2.解包 cd 切換到當前使用者家目錄 tar zxvf mysql 5.5.22.tar.gz c usr src 解壓軟體包 cd usr src mysql 5....
LNMP環境搭建 PHP編譯安裝
準備工作 php 官網位址 mysql 官網位址 php 安裝 先安裝一些通常來說應該已經有的元件,以防沒有可以檢查並安裝一下 yum y install gcc automake autoconf libtool make gcc c glibc安裝依賴庫 yum y install libmcr...