1.安裝必要源
yum -y install make bison-devel ncures-devel libaio perl-data
-dumper net-tools bison bison-devel gcc-c
++ cmake ncurses ncurses-devel
2.解壓、編譯、安裝
[root@s160 opt]# tar zxvf mysql-5.6.41.tar.gz
[root@s160 mysql-5.6.41]# cd mysql-5.6.41/
[root@s160 mysql-5.6.41]# cmake \-dcmake_install_prefix=/usr/local/mysql56
[root@s160 mysql-5.6.41]# make && make install
3.新增系統使用者,授權
useradd mysql
chown -r mysql:mysql /usr/local/mysql56
4.建立/data/mysqldb/data目錄,修改許可權
mkdir -p /data/mysqldb/data
chown -r mysql:mysql /data/mysqldb
初始化
/usr/local/mysql56/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql56 --datadir=/data/mysqldb/data
5.新增並修改/etc/my.cnf檔案
[root@s160 data]# cp /usr/local/mysql56/support-files/my-default.cnf /etc/my.cnf
修改my.cnf檔案
# for advice on how to change settings please see
# # *** do not edit this file. it's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of mysql.
[mysqld]
basedir = /data/mysql
datadir = /data/mysqldb/data
log-error=/data/mysql/mysqllog/logerr.log
tmpdir=/data/mysqldb
pid-file=/data/mysql/mysql.pid
socket=/home/mysql/mysqld.sock
lc_messages_dir=/usr/local/mysql56/share
port=3306
server_id=1
[client]
socket=/home/mysql/mysqld.sock
建立目錄/data/mysql/mysqllog
[root@s160 mysql]# mkdir -p /data/mysql/mysqllog
[root@s160 mysql]# chown -r mysql:mysql /data/mysql
6.新增開機啟動
1)將mysql加入到systemctl管理
touch /usr/lib/systemd/system/mysqld.service
2)編輯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/mysql56/bin/mysqld --defaults-file=/etc/my.cnf
limitnofile = 5000
#restart=on-failure
#restartpreventexitstatus=1
#privatetmp=false
3)加入開機啟動
systemctl enable mysqld
4)配置mysql環境變數/etc/profile
export mysql_home=/usr/local/mysql56
export path=$path:$mysql_home/bin
配置生效 source /etc/profile
5)啟動mysql
systemctl start mysqld.service
6)登入mysql並修改密碼
[root@s160 data]# mysql -u root -p
enter password:
welcome to the mysql monitor. commands end
with ; or \g.
your mysql connection id is
2server version: 5.6.41-log 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> set password for
'root'@'localhost' = password('1234@abcd');
query ok, 0 rows affected (0.00 sec)
mysql> flush privileges;
query ok, 0 rows affected (0.00 sec)
mysql> exit
bye
Centos7原始碼安裝PHP
安裝依賴libxml2 devel 後期安裝時,如果不報錯也可以不用安裝 原始碼安裝步驟 wget c 2.解壓tar zxvf php 7.2.4.tar.gz 3.安裝編譯 configure prefix 安裝目錄 引數 configure prefix usr local php with ...
centos7 原始碼安裝 nginx php7
wget解壓php tar zxvf php 7.1.12.tar.gz安裝擴充套件包 這裡可以通過yum安裝,或者原始碼安裝。不一一舉例 編譯 這裡需要建立使用者,與使用者。我建立的是alienjun使用者與使用者組,根據自己實際情況建立 configure prefix usr local ph...
Centos7原始碼安裝Swoole
swoole 源 編譯安裝 注 本人一直推崇原始碼安裝軟體,因為可以更好的理解其中的原理。廢話不說開始 1.安裝 git 轉殖 swoole 源 編譯安裝 1.安裝依賴包 yum install curl devel expat devel gettext devel openssl devel z...