摰鋆摰Mysql 敺閮剖 :
* k- z Z8 s5 m脖甇亥身摰 MySQL0 r9 l% [: R6 m5 q5 d' j
A.
) C7 E7 W; B1 Y+ z) C閮剖php.ini(/etc/php.ini)
a. [+ ?1 ]% h1 r3 |/ [php.ini
l: s7 l! M+ I3 d& u7 {$ P1 memory_limit = 128M //PHP舐刻園銝& a. x5 |3 E# w3 J+ P: K! W
2 display_errors = Off //憿舐內航炊閮5 u7 P1 Z7 Y: U6 F* \/ S
3 date.timezone = Asia/Taipei //(銵閬閮剖嚗銝賀HP雿輻典唳賣豢航炊閮)
* Y( z9 l4 v$ B; q, M7 n* J4 session.cookie_lifetime = 0 //session摮瘣餅(桐蝘嚗0隞銵典瘣餉喟閬賢券); s1 K8 p$ a" n n' d
4 Y6 z& z& F5 I* T+ PB. ]! v+ I, i: N0 M
閮剖my.cnf(/etc/my.cnf)
0 }2 j- P" A4 K* Kmy.cnf : - q9 `1 X1 h0 a8 W
1 log-error=/var/log/mysqld.log //亥摮曆蝵7 _, j! u( b" E: a: `% _3 ~6 s
2 connect_timeout = 15 //蝺timeout$ u& C2 l* R2 e/ S3 |
3 max_connections = 3000 //憭折蝺
( }6 w: h; b" t4 L& N; g7 _. _4. service mysqld restart9 g, f( H& z& B
6 E8 w# T8 _ H! ~' ]5 n' u3 Z6 s3 M% i c& A: ^+ S
C.
, o$ Z+ |2 o" `/ J閮剖 MySQL 鞈摨怎恣 root 撣單嗥撖蝣潘瑁sudo mysql_secure_installation嚗隞雿摨銝撟曆辣鈭
5 Z: G* `2 i1 S( \1. Enter current password for root (enter for none): // 湔交 Enter嚗粹閮剜撖蝣
8 y# B. h0 `1 {$ T- W7 I2. Set root password? [Y/n] //頛詨 Y 靘閮剖撖蝣
1 p( z b5 G1 T! s3. New password: // 頛詨 root 啣蝣0 F% m& X% c$ _5 M
4. Re-enter new password: // 銝甈∟撓 root 啣蝣
% n0 V& Z% _& `6 K+ \4 i5. Remove anonymous users? [Y/n] //閮 Yes 嚗湔交 Enter
0 Z; O# E. R# m8 f$ }; U7 V8 z* g6. Disallow root login remotely? [Y/n] //閮 Yes 嚗湔交 Enter
5 Y |2 z* q5 F y1 X |2 ]6 s7. Remove test database and access to it? [Y/n] //閮 Yes 嚗湔交 Enter
6 {, F; A/ k$ [/ L9 D8. Reload privilege tables now? [Y/n] //閮 Yes 嚗湔交 Enter
3 ^1 v0 U7 Q) C8 D6 c% {- K' d
$ `8 p& Z% Z" @( |5 a5 ]
* a5 C }1 Z5 C& x9 v* M亥拍典閮剖 root 撖蝣潛餃 MySQL嚗瑁sudo mysql -u root -p嚗撖蝣潭迤蝣箏停脣乓mysql>璅蝷箇泵
- E; q0 e; m& f8 G/ O( |; j 瑁豢閬券鞈摨+ p' P( s0 R2 z% [6 Z) J
mysql> use mysql
: f, v ?, N/ C: p- C
8 M% J7 }! e" `: L, H2 r: M; j 瑁select host,user from user ;閬蝯撠暹瑁, {5 |' @4 `: ~7 }; A2 d: Q, J
mysql> select host,user from user ;$ q$ r5 W% s0 n# m+ c
+-----------+------+
6 \6 U. Y' i& w6 a| host | user |
' b, u0 g& p% T+-----------+------+
2 o! Y; ?8 B. x9 y# M4 x| 127.0.0.1 | root |$ x7 p4 |5 g+ O, z0 I- y
| localhost | root |
4 [8 Z& V& P m% c4 a5 g+-----------+------+
8 S: t A- _ [7 P# M2 rows in set (0.00 sec)! [3 \( T0 `! b3 X+ D
/ \; B& _# N& O( i+ ? 啣銝雿輻刻
, B& U* A' ^% v2 F2 R: Z9 j, Cinsert into user (host,user,password) values ('%','your_account',password('your_password'));1 X$ q" c% p1 H& {9 R0 }
7 ^% e3 O; I' n8 P/ [餅閰脖蝙刻蝞∠甈嚗璅雿賣颲行蝡航 嚗 root 蝡舐餃亥◤鈭嚗
! z$ m0 M3 _8 K* @3 l8 q: wGRANT ALL ON *.* TO 'your_account'@140.112.1.1 IDENTIFIED BY 'your_password' WITH GRANT OPTION;
8 a2 [8 N* N; j0 N0 w" O銝嗅撣唾嚗芣臭祈摨思蝙刻撣唾嚗銝瘝隞颱甈0 _) ], K. |6 ?5 Z+ k$ q) b
餉閮剖5 q; ^8 ?% s2 H
FLUSH PRIVILEGES;. k2 E2 E' K! k3 P+ h& p- k# S5 ]
摰鋆摰Phpmyadmin ,run http://www.domain.com/dbadmin show error : The mbstring extension is missing. Please check your PHP configuration.5 H M3 ]6 v; f9 Q4 U. `
隢摰鋆
9 w* ] |0 ~3 K- t E5 h ! Q* i V8 L* B8 m: B1 v, t
yum -y install php-mbstring- b: X9 G2 K, s
4 Z& U) \. w; T1 y) c2 [2 e亙箇曄撩撠mcrypt嚗隢摰鋆
$ J# |3 g( E) _
) c: l8 j+ \, `, h, L! P7 B) ryum -y install mcrypt
* ?0 k( x# \+ c4 w) D9 [) ~service nginx restart6 j& u3 T; R# b; S/ _
Login phpadmin 敺箇 error:蝻箏 mysqli 游憟隞嗚隢瑼X PHP 閮剖Solution:
% w d1 q" D$ s" Lphp -m | grep mysqli ===> confirm mysqli module is installed
3 e8 w& Y, t0 z- J' Z2 I2 g/ Zphp -i | grep extension_dir ===> 撠曉辣隡貊桅
/ ^- Q- v5 m5 R" f5 dyum -y install php-mysql ( yum install php5-mysqli) ===> ok( ^. m! t% H$ m+ N
蝻箏 mcrypt 游憟隞嗚隢瑼X PHP 閮剖8 O, ~/ l8 \; @4 \9 l6 ?
yum install php-mcrypt7 e) f7 R, _) h; ^" {$ L
yum install libmcrypt libmcrypt-devel ===> ok1 y) `) W1 x; o _3 p# F
' \- C3 u, M2 m! s& V4 T3 L6 y9 y: k+ M8 x: L$ Y
|
|