摰鋆摰Mysql 敺閮剖 :2 h% d6 l- @9 M$ }. b
脖甇亥身摰 MySQL6 X! Q6 s1 ~/ }; L: J
A." Y+ Z( y/ e' B" U; d% V7 i3 ]% @
閮剖php.ini(/etc/php.ini)+ b* N% K8 n: \9 T9 x o# L2 U( I
php.ini1 U; {! c' ]- z* |7 {
1 memory_limit = 128M //PHP舐刻園銝+ Z" s* m7 C* s, g, x
2 display_errors = Off //憿舐內航炊閮
* }. m2 P4 c, S5 R3 date.timezone = Asia/Taipei //(銵閬閮剖嚗銝賀HP雿輻典唳賣豢航炊閮)- A3 Q# R/ T9 _
4 session.cookie_lifetime = 0 //session摮瘣餅(桐蝘嚗0隞銵典瘣餉喟閬賢券)
6 z1 j9 Q8 a! V* U" y) R6 s# d" i) N2 ~6 J; b ~9 j$ @# K% S- T
B./ R+ n. ^1 U- v9 ]4 D; Q; R! U. J3 r
閮剖my.cnf(/etc/my.cnf)
1 U! p4 i T# }. |0 @my.cnf : 6 D% b h3 |! H- D* t
1 log-error=/var/log/mysqld.log //亥摮曆蝵
* f1 u7 k) p9 X2 connect_timeout = 15 //蝺timeout
; T3 P4 g! Z$ |+ i0 C3 max_connections = 3000 //憭折蝺: W" [: L( K' t! d6 J
4. service mysqld restart
1 t D. x# w% a* r" Y7 b( z! I6 B' d+ S; _9 q
9 Z3 I1 G" N+ ]' L5 CC.
! R' E5 j4 i& a& l. Q閮剖 MySQL 鞈摨怎恣 root 撣單嗥撖蝣潘瑁sudo mysql_secure_installation嚗隞雿摨銝撟曆辣鈭
# p' k( O3 |6 U4 Q! y1. Enter current password for root (enter for none): // 湔交 Enter嚗粹閮剜撖蝣# R( m% O' V5 k2 n# A) N t
2. Set root password? [Y/n] //頛詨 Y 靘閮剖撖蝣
) T$ j I5 Q2 l) V( T3. New password: // 頛詨 root 啣蝣6 g" {& r' g& ?4 j
4. Re-enter new password: // 銝甈∟撓 root 啣蝣
; U# n$ Q {6 T) e- ~5. Remove anonymous users? [Y/n] //閮 Yes 嚗湔交 Enter
6 j& u0 J: l5 o$ w& H6. Disallow root login remotely? [Y/n] //閮 Yes 嚗湔交 Enter; H! s+ g) L9 x% r' s
7. Remove test database and access to it? [Y/n] //閮 Yes 嚗湔交 Enter
/ i, W9 q8 ^9 Y5 V V8. Reload privilege tables now? [Y/n] //閮 Yes 嚗湔交 Enter
8 ? M/ R3 ^0 L8 N+ E. Z* t3 i5 ?$ j* B
3 @, M! L; p7 o% w& ?9 b) C) Y' ~# l亥拍典閮剖 root 撖蝣潛餃 MySQL嚗瑁sudo mysql -u root -p嚗撖蝣潭迤蝣箏停脣乓mysql>璅蝷箇泵
. {8 o. S# N* v6 A 瑁豢閬券鞈摨# w* f) ]2 P# N( ~% E! c8 @' ~
mysql> use mysql
2 {9 w) o: r! |+ x' C; w# _
. M+ d9 c: i) M 瑁select host,user from user ;閬蝯撠暹瑁 R$ z1 k- s: W5 L8 L! L
mysql> select host,user from user ;
7 o ~( v4 M) t- q* W+-----------+------+
# H! }9 f, s3 `0 k2 @- \7 ]. j| host | user |
0 P/ F9 \' w# J) B+-----------+------+: g" N' f% M& [$ s y8 {- R* [
| 127.0.0.1 | root |. W5 W, G' s! D: Y' ]
| localhost | root |
: i/ \. }% j: @' \5 q+-----------+------+
( Q) F& t- g) P0 v& a& q4 {2 rows in set (0.00 sec)9 B Q0 Y- d6 Q8 F
9 w% h0 D$ J/ d% L% t
啣銝雿輻刻
/ ~3 y# c' @& ?insert into user (host,user,password) values ('%','your_account',password('your_password'));
% o4 I4 L5 U4 V9 D0 Q! w7 S+ N
$ }8 Q; C r' n. T* H餅閰脖蝙刻蝞∠甈嚗璅雿賣颲行蝡航 嚗 root 蝡舐餃亥◤鈭嚗
. F5 x& y, q& ]3 J* UGRANT ALL ON *.* TO 'your_account'@140.112.1.1 IDENTIFIED BY 'your_password' WITH GRANT OPTION;
4 B* A1 S! k3 N2 R+ \3 R銝嗅撣唾嚗芣臭祈摨思蝙刻撣唾嚗銝瘝隞颱甈/ ~+ E4 ^. i: X6 e6 {+ X" ?
餉閮剖
" ?- c! n a6 yFLUSH PRIVILEGES;
! F6 i% a) J6 s2 K; J( o摰鋆摰Phpmyadmin ,run http://www.domain.com/dbadmin show error : The mbstring extension is missing. Please check your PHP configuration.( C, n8 A: L( ~ k% i- j9 {- `
隢摰鋆+ v) ~' e+ {" T E' u2 ]6 Z6 [
0 W% w' {# j0 O9 Q/ h! k
yum -y install php-mbstring
1 i. N7 O2 K) y8 [3 V; H: T
: `5 Z- h: {' t2 \) v+ [亙箇曄撩撠mcrypt嚗隢摰鋆
" ?' b! K1 Q# G7 s+ _
6 A8 x) g2 r/ g) zyum -y install mcrypt. [+ m- x4 v4 J9 Q8 N
service nginx restart+ J( Y4 _, W' k
Login phpadmin 敺箇 error:蝻箏 mysqli 游憟隞嗚隢瑼X PHP 閮剖Solution:
- x" k9 A: J. Z5 `% Z7 S' @php -m | grep mysqli ===> confirm mysqli module is installed) w, x. F4 Z, n' O% N$ T5 K
php -i | grep extension_dir ===> 撠曉辣隡貊桅7 F& D) ?6 w# D
yum -y install php-mysql ( yum install php5-mysqli) ===> ok
8 X' w# p7 O4 [' \; g ]* b1 w8 o蝻箏 mcrypt 游憟隞嗚隢瑼X PHP 閮剖$ q3 N, T+ Z H* O
yum install php-mcrypt, {. g4 l7 A- ]' q
yum install libmcrypt libmcrypt-devel ===> ok
, T/ N* {; v6 f9 v3 n/ _8 H& w% ?
4 ^: x- f% q/ U
@0 S1 v: F! r; | ?. m8 {" ] |
|