摰鋆摰Mysql 敺閮剖 :
4 m" e; p0 J) h5 p+ {脖甇亥身摰 MySQL
; R! M& n( u, X$ @0 d( w3 L- `7 JA.: n6 H3 F: e) C2 C! n
閮剖php.ini(/etc/php.ini)
6 o( C0 N# X) e% T4 {; uphp.ini* t7 X$ y' b! }- G5 A
1 memory_limit = 128M //PHP舐刻園銝3 D/ r- i- X, d( r |3 z
2 display_errors = Off //憿舐內航炊閮
, I7 A' B! T$ {/ I3 date.timezone = Asia/Taipei //(銵閬閮剖嚗銝賀HP雿輻典唳賣豢航炊閮)9 H! g1 m& V. y/ H9 x
4 session.cookie_lifetime = 0 //session摮瘣餅(桐蝘嚗0隞銵典瘣餉喟閬賢券)
" U% u& y$ B4 G5 L- e9 o4 |8 R$ l9 U) F& I
B.6 Z: Q1 v3 X2 x! S0 \- E/ A8 |
閮剖my.cnf(/etc/my.cnf)
! @$ ]4 i8 h; u9 dmy.cnf :
) t+ z y; R6 c1 log-error=/var/log/mysqld.log //亥摮曆蝵4 {5 j6 F1 b7 O7 l, s* O1 C u2 B
2 connect_timeout = 15 //蝺timeout
" M: {( F: b# m4 x3 V1 z3 max_connections = 3000 //憭折蝺
s2 s' m, Y7 U3 I& s. a4. service mysqld restart9 |3 ?. ]$ T9 X! Y2 d3 q
. j( ^' u2 F! V" ?( @/ h' `5 u$ b8 P; H( _
C.
( b, P5 k( W( r- U2 B閮剖 MySQL 鞈摨怎恣 root 撣單嗥撖蝣潘瑁sudo mysql_secure_installation嚗隞雿摨銝撟曆辣鈭
6 G: M" i8 n3 @- H* ]5 n4 [1. Enter current password for root (enter for none): // 湔交 Enter嚗粹閮剜撖蝣
9 P$ P2 \2 {5 {* V' y- a2 E2. Set root password? [Y/n] //頛詨 Y 靘閮剖撖蝣
% v) n2 {4 |& s' v. D. @, x+ o, ]% z3. New password: // 頛詨 root 啣蝣
$ A E8 @1 n' [) J9 X2 C( c# W4. Re-enter new password: // 銝甈∟撓 root 啣蝣
, u6 N/ _1 y! E3 g5. Remove anonymous users? [Y/n] //閮 Yes 嚗湔交 Enter2 {3 l0 r" n& _
6. Disallow root login remotely? [Y/n] //閮 Yes 嚗湔交 Enter3 ^7 L' A. r* N& ~6 G( ]4 E
7. Remove test database and access to it? [Y/n] //閮 Yes 嚗湔交 Enter
8 d3 M. Q$ N& m9 x- T8. Reload privilege tables now? [Y/n] //閮 Yes 嚗湔交 Enter
9 F4 H* O% a3 S1 e- D1 X# a" G& f; D, g/ v: P
3 R1 r" p' t3 h. ^
亥拍典閮剖 root 撖蝣潛餃 MySQL嚗瑁sudo mysql -u root -p嚗撖蝣潭迤蝣箏停脣乓mysql>璅蝷箇泵
+ ?; l \' ~! U9 E0 [6 M& K 瑁豢閬券鞈摨* x/ I* _3 r7 r; H
mysql> use mysql
7 y2 W) j) \4 q4 I$ Y; E$ _* V; \4 P* P3 f
瑁select host,user from user ;閬蝯撠暹瑁
6 i' Q# h8 M, l3 J. D; t C8 Y( c, `mysql> select host,user from user ;
* A4 u& K& P) Z& {( p+-----------+------+
6 K8 O8 l. k( Q; [3 B! || host | user |9 x0 F7 [+ Y) G5 ]4 m2 n7 ]2 k& V
+-----------+------+
, Z! J a- L% d! j0 ^ f8 q| 127.0.0.1 | root |
0 k0 u- j V+ I( m$ {( i$ c# i' W/ E| localhost | root |3 j( ]. ?" o5 O3 s/ _- K7 J
+-----------+------+& |5 g& P% W0 g% o
2 rows in set (0.00 sec)
j; c' `5 y) T8 N; {
3 P0 U& } A! ?; V+ \ 啣銝雿輻刻0 c3 }7 Q, d0 F# [- I! h$ V# R: W
insert into user (host,user,password) values ('%','your_account',password('your_password'));2 m, g7 p$ L: h* A0 f# Q& M
! A( V! U. j7 I餅閰脖蝙刻蝞∠甈嚗璅雿賣颲行蝡航 嚗 root 蝡舐餃亥◤鈭嚗
L, V7 I, D$ a* J9 ^, KGRANT ALL ON *.* TO 'your_account'@140.112.1.1 IDENTIFIED BY 'your_password' WITH GRANT OPTION;( C& Q: Q& p4 D% @
銝嗅撣唾嚗芣臭祈摨思蝙刻撣唾嚗銝瘝隞颱甈# d0 F, ]4 V) J. r4 _
餉閮剖
, j2 x6 c! E0 S/ }1 g! k) m/ V2 }FLUSH PRIVILEGES;
! P W+ G% O) H2 _8 F- P2 J& r摰鋆摰Phpmyadmin ,run http://www.domain.com/dbadmin show error : The mbstring extension is missing. Please check your PHP configuration.
) q- m7 g6 B* v6 }* W% j0 t隢摰鋆, A7 k3 r; b+ u/ Y5 J( S) ~
7 B0 j4 R* s J/ P( Pyum -y install php-mbstring
- A9 a3 A: |. E5 o! W" F8 i7 V) M+ _$ t8 }
亙箇曄撩撠mcrypt嚗隢摰鋆
1 x4 H. u) @- j9 C & T0 W! A/ G7 | d+ [3 ?5 l; m) P
yum -y install mcrypt
9 s# F4 x: J1 r' |/ }" M }. H3 kservice nginx restart N9 l; b+ a& s- c
Login phpadmin 敺箇 error:蝻箏 mysqli 游憟隞嗚隢瑼X PHP 閮剖Solution:( s! @9 I1 s! I! ?0 V; v# m# t0 k
php -m | grep mysqli ===> confirm mysqli module is installed
m: A3 s2 x* n4 D. [/ t8 sphp -i | grep extension_dir ===> 撠曉辣隡貊桅
8 }4 E9 f6 M: s; e i# k9 nyum -y install php-mysql ( yum install php5-mysqli) ===> ok
* M1 `+ i% p1 u2 ?3 `蝻箏 mcrypt 游憟隞嗚隢瑼X PHP 閮剖
; I, o4 Z: l) x$ [yum install php-mcrypt
7 ~" e/ y: G0 ]4 |( _( fyum install libmcrypt libmcrypt-devel ===> ok
7 t7 I! E8 H! ` |) F! {
0 G3 J, t8 Q. u& }2 B3 \4 I5 S, M8 R1 k6 X/ G; |& f; Z
|
|