摰鋆摰Mysql 敺閮剖 :1 m$ X" n$ H) z
脖甇亥身摰 MySQL
; i/ B4 X1 y( k% p; s, b1 e WA.
) s7 n' R' @8 ^, C% V! K% y閮剖php.ini(/etc/php.ini)
0 }; K1 W. f) P# \& E c6 sphp.ini5 C) @1 Y% j1 t+ \! q( _4 }5 d9 ]& x
1 memory_limit = 128M //PHP舐刻園銝
% c, t& K9 `- t7 X, q6 ?2 display_errors = Off //憿舐內航炊閮- [# k8 V1 i1 b: p, ~0 i
3 date.timezone = Asia/Taipei //(銵閬閮剖嚗銝賀HP雿輻典唳賣豢航炊閮)- Z& ?4 H7 ]/ }0 Y
4 session.cookie_lifetime = 0 //session摮瘣餅(桐蝘嚗0隞銵典瘣餉喟閬賢券)0 G& {9 s3 @& X: R% h/ \' Y
( y+ N7 j/ W' {. `B.7 e% W Z( j5 G
閮剖my.cnf(/etc/my.cnf)
/ ?( H. l$ ]1 u& lmy.cnf : x$ g8 y y% @/ Z( D. t; ]$ L
1 log-error=/var/log/mysqld.log //亥摮曆蝵
& J; E- \% X$ M; D) {+ @+ E: \3 z2 connect_timeout = 15 //蝺timeout" D0 _4 q0 A& X! c/ c$ o
3 max_connections = 3000 //憭折蝺
5 P* [1 {+ L( K+ ~ R" T4. service mysqld restart
+ b+ p! Z( R7 K) A! B1 C. {6 C H0 |) K6 U! s4 d5 O7 f2 m
/ ^" L' U: ^& b: {- d" |; WC.$ u$ q# X; Y+ E" [/ k& ^# Y( v! C
閮剖 MySQL 鞈摨怎恣 root 撣單嗥撖蝣潘瑁sudo mysql_secure_installation嚗隞雿摨銝撟曆辣鈭
) I: p5 P$ w; f1. Enter current password for root (enter for none): // 湔交 Enter嚗粹閮剜撖蝣! _6 G* P2 i" b# L- _& }$ G+ A
2. Set root password? [Y/n] //頛詨 Y 靘閮剖撖蝣# B6 g5 T9 o6 _
3. New password: // 頛詨 root 啣蝣
# C$ E4 e0 b/ }4. Re-enter new password: // 銝甈∟撓 root 啣蝣& S/ c6 r7 n0 e0 ]3 h) i
5. Remove anonymous users? [Y/n] //閮 Yes 嚗湔交 Enter/ L: \4 a; V# _+ M& E
6. Disallow root login remotely? [Y/n] //閮 Yes 嚗湔交 Enter
& [" d- r) m+ X- D$ K7. Remove test database and access to it? [Y/n] //閮 Yes 嚗湔交 Enter1 T* ]3 Q \: ?# w Q( n3 D+ K( S
8. Reload privilege tables now? [Y/n] //閮 Yes 嚗湔交 Enter
% R1 `5 w, f; v
Q8 | w& N$ l% ?. n S$ }: ], z0 ` F& H: W1 ?
亥拍典閮剖 root 撖蝣潛餃 MySQL嚗瑁sudo mysql -u root -p嚗撖蝣潭迤蝣箏停脣乓mysql>璅蝷箇泵
) p& E+ x' a$ i1 u 瑁豢閬券鞈摨
4 w# A$ f5 m1 X% Mmysql> use mysql
Q w6 J+ F* Z) M" S# F" `
# L$ T5 d1 }. M7 B) S8 [ 瑁select host,user from user ;閬蝯撠暹瑁, Q2 f- X# R2 j, g# G6 h
mysql> select host,user from user ;/ A: a& p5 }4 E2 h; r& O
+-----------+------+
$ V/ v) T) z4 V# i& b| host | user |
. c! D" V1 s; x) R+-----------+------+
. `2 @8 U. m# B| 127.0.0.1 | root |2 M2 }0 m8 Y/ t% r
| localhost | root |) S* }6 j3 w I7 N
+-----------+------+
0 b: f$ l' C n9 J. }: g2 rows in set (0.00 sec)
. _" M/ N- U# K( h$ T7 d1 e. M, F+ [2 @- i
啣銝雿輻刻 p+ q; d2 U5 l! b n, Z
insert into user (host,user,password) values ('%','your_account',password('your_password'));7 v0 y; o& ?8 w# P: V1 [: ?& V
+ R* I% l$ Y* n( _2 g
餅閰脖蝙刻蝞∠甈嚗璅雿賣颲行蝡航 嚗 root 蝡舐餃亥◤鈭嚗 . F4 b$ W* n% a' U6 h' G
GRANT ALL ON *.* TO 'your_account'@140.112.1.1 IDENTIFIED BY 'your_password' WITH GRANT OPTION;
! E5 A' U3 d5 r- s$ K& [8 o) ]: {2 a銝嗅撣唾嚗芣臭祈摨思蝙刻撣唾嚗銝瘝隞颱甈( x8 M2 I2 T# B3 i, Q2 I" K
餉閮剖
9 ?2 F* |8 Z& pFLUSH PRIVILEGES;6 i t6 U4 a* f9 b& R( n3 C% @+ c
摰鋆摰Phpmyadmin ,run http://www.domain.com/dbadmin show error : The mbstring extension is missing. Please check your PHP configuration.
) w% `. }9 v& H* h# R# I隢摰鋆
# n7 N3 D( I& D6 \ 9 e. K0 A+ ~8 Z9 T1 i! q7 l" `( O
yum -y install php-mbstring4 ~0 w7 P) Y5 Y
* n: F- g% |/ [% g* a亙箇曄撩撠mcrypt嚗隢摰鋆: }1 n) u$ Y' c5 D3 \
, Z' D$ Y5 G6 a4 c$ b9 hyum -y install mcrypt
4 h9 Z$ k3 F+ D( pservice nginx restart
2 S& b0 d2 H4 b# R0 q( sLogin phpadmin 敺箇 error:蝻箏 mysqli 游憟隞嗚隢瑼X PHP 閮剖Solution:: c8 u" F# m: g: j- T" k9 i6 N
php -m | grep mysqli ===> confirm mysqli module is installed
T2 K) `6 z4 f. ~7 H L- Ophp -i | grep extension_dir ===> 撠曉辣隡貊桅9 R/ @' t- b8 Q1 O+ m
yum -y install php-mysql ( yum install php5-mysqli) ===> ok
# W7 }3 f) w# v蝻箏 mcrypt 游憟隞嗚隢瑼X PHP 閮剖( c. ^" T9 s+ r) t& T4 r( K
yum install php-mcrypt
2 p+ j2 \% r' C- P3 {8 ?: g2 cyum install libmcrypt libmcrypt-devel ===> ok( ]7 g7 r; k" I& B
5 h+ l0 B+ y3 i- N: M$ d
5 i! o/ n, _' O3 J
|
|