摰鋆摰Mysql 敺閮剖 :
3 F8 o, B- w, h脖甇亥身摰 MySQL9 E" |: k6 v# b$ Y) G. }1 M
A.
4 _/ b: _# ?: H& T閮剖php.ini(/etc/php.ini): b6 {" G8 c2 Z k- Y! Q) Z0 ~
php.ini( o! P& S3 o* l" M- {* ^2 v
1 memory_limit = 128M //PHP舐刻園銝
9 Z0 M/ g; w+ W$ g; ?% l9 K% |! Y0 e2 display_errors = Off //憿舐內航炊閮
: S, e2 y" M* \2 _4 u3 date.timezone = Asia/Taipei //(銵閬閮剖嚗銝賀HP雿輻典唳賣豢航炊閮)
& V: u/ z( B0 q; \4 session.cookie_lifetime = 0 //session摮瘣餅(桐蝘嚗0隞銵典瘣餉喟閬賢券)
8 i$ r& @) j) h9 q2 i2 l% V. \2 F' h& I* r/ O- W
B.
; \8 B( X" c; ^閮剖my.cnf(/etc/my.cnf)
) h7 V! ~" B4 D4 Z" emy.cnf :
6 _. [9 Z7 L3 s1 log-error=/var/log/mysqld.log //亥摮曆蝵
/ u$ v. w' p8 t, w+ y2 connect_timeout = 15 //蝺timeout
7 e# Y( i4 S) K# ~3 max_connections = 3000 //憭折蝺
$ J9 p: C5 W0 A4. service mysqld restart* d. E, }+ E5 D0 d
; s' m5 ]/ @ @( J
! e+ w+ g$ j1 P! c* {+ d1 k, D
C.; |" Z" s! d& f+ j- x: h/ ^
閮剖 MySQL 鞈摨怎恣 root 撣單嗥撖蝣潘瑁sudo mysql_secure_installation嚗隞雿摨銝撟曆辣鈭
" Z9 c& X6 ]) c0 M" L/ p1. Enter current password for root (enter for none): // 湔交 Enter嚗粹閮剜撖蝣
& h# d9 R: `( R4 L- H2. Set root password? [Y/n] //頛詨 Y 靘閮剖撖蝣- H3 ^2 {( y2 a; {& Q F$ Z9 v
3. New password: // 頛詨 root 啣蝣$ c% Z- K2 a. ?) c/ ]
4. Re-enter new password: // 銝甈∟撓 root 啣蝣
# U: l6 a0 t/ @# h, D5 ]5. Remove anonymous users? [Y/n] //閮 Yes 嚗湔交 Enter# n1 h4 `2 M3 m
6. Disallow root login remotely? [Y/n] //閮 Yes 嚗湔交 Enter
% W5 C7 s. L7 c. t7. Remove test database and access to it? [Y/n] //閮 Yes 嚗湔交 Enter; s, z0 C8 ~1 K7 y* i
8. Reload privilege tables now? [Y/n] //閮 Yes 嚗湔交 Enter
5 y( K* C& m5 K1 o( e: ~3 U, a! L* E% ~# S
, b, L9 m) x# g( X亥拍典閮剖 root 撖蝣潛餃 MySQL嚗瑁sudo mysql -u root -p嚗撖蝣潭迤蝣箏停脣乓mysql>璅蝷箇泵
+ f2 ^2 u- W0 N0 T" j( z 瑁豢閬券鞈摨8 @% C# l" v0 v9 B6 H6 s1 L( f) v
mysql> use mysql
P8 y( t3 j- e! @' M
8 r' i( s1 J8 R, b( w! t$ ?( A8 a 瑁select host,user from user ;閬蝯撠暹瑁9 u9 J% x2 \1 p6 B! C
mysql> select host,user from user ;
) x5 k/ G* W: c' @9 E+-----------+------+
* N( B" \/ C t$ }| host | user |% D# W# d. W8 V1 J# |7 _
+-----------+------+, u& |! A5 D& e8 \
| 127.0.0.1 | root |
2 a! n4 _. A- B5 V; {9 [& i$ A. f| localhost | root |
- `' ?8 J7 I% E- N+-----------+------+% M4 @5 e. u* F# I6 u
2 rows in set (0.00 sec)
+ E- _4 t6 I, y/ J0 f6 C, v0 I
; P3 d* }9 Q' x- Y1 ?' q! @; ?4 P 啣銝雿輻刻, R, b2 N/ m* f; c) E% f
insert into user (host,user,password) values ('%','your_account',password('your_password'));
+ n' x) y, x5 f4 _& ]3 l
8 l" E/ ?$ G/ {" `" [餅閰脖蝙刻蝞∠甈嚗璅雿賣颲行蝡航 嚗 root 蝡舐餃亥◤鈭嚗 . X1 m/ Y( k" L. p) L
GRANT ALL ON *.* TO 'your_account'@140.112.1.1 IDENTIFIED BY 'your_password' WITH GRANT OPTION; }8 {& @$ H. i: k" v& u8 Z
銝嗅撣唾嚗芣臭祈摨思蝙刻撣唾嚗銝瘝隞颱甈9 l- B3 L* w4 m I$ q1 p& z4 o
餉閮剖
0 T9 ]$ K. R% ]+ H" _% pFLUSH PRIVILEGES;& e# L* @- E: N. i- S0 A. E8 x
摰鋆摰Phpmyadmin ,run http://www.domain.com/dbadmin show error : The mbstring extension is missing. Please check your PHP configuration.9 m! V: }' Q2 r8 c! K1 I8 t- M, X
隢摰鋆
3 I' k. e) u; s3 E7 \6 |
& S! Y% o9 r m5 a& Xyum -y install php-mbstring
) ?0 d2 a+ ]+ [$ y, V* f
1 b m( |' h) Q! ~/ s. l/ ^- V3 d/ b亙箇曄撩撠mcrypt嚗隢摰鋆
/ r; Q r& @8 R/ g% E Y+ l 4 M5 n6 c* ?* K+ K
yum -y install mcrypt' u R- J f2 S
service nginx restart2 ~3 W( p! `8 z. e; h
Login phpadmin 敺箇 error:蝻箏 mysqli 游憟隞嗚隢瑼X PHP 閮剖Solution:7 w& D$ V" f+ k0 }: R, D" O
php -m | grep mysqli ===> confirm mysqli module is installed B0 |" @1 C) K
php -i | grep extension_dir ===> 撠曉辣隡貊桅
' Y- b# S1 ^/ `" L. m% V% i0 Cyum -y install php-mysql ( yum install php5-mysqli) ===> ok
7 _. N! l& K1 U) [: z蝻箏 mcrypt 游憟隞嗚隢瑼X PHP 閮剖0 x+ v- @+ G7 d. y& P
yum install php-mcrypt) Y! ~' l/ o" P" Z
yum install libmcrypt libmcrypt-devel ===> ok/ S+ Z& ?4 P. {9 \( M9 d+ y
6 y3 E$ C, o; r$ t
$ h7 L0 w" |9 P+ D) S' K) ?$ w
|
|