摰鋆摰Mysql 敺閮剖 :
0 J6 W3 \- U$ P7 P4 I) s脖甇亥身摰 MySQL6 t) ^: U! \9 n/ b2 b
A.% t1 ?7 N+ e5 ^- c
閮剖php.ini(/etc/php.ini)% P4 W& ~! |* x
php.ini
; ~ _) u* R2 u5 n1 K/ u7 t1 memory_limit = 128M //PHP舐刻園銝
. C. @6 P8 Y! X5 m6 l2 display_errors = Off //憿舐內航炊閮
# Z1 n" i6 c1 B. m* y3 date.timezone = Asia/Taipei //(銵閬閮剖嚗銝賀HP雿輻典唳賣豢航炊閮)
( |- L# e; X2 A$ b4 session.cookie_lifetime = 0 //session摮瘣餅(桐蝘嚗0隞銵典瘣餉喟閬賢券)
- ]2 z+ P" A- Q& ]3 q9 f- f8 v" E' [4 t* d
B.& Z8 Q; k7 N, E; w
閮剖my.cnf(/etc/my.cnf)) u' }5 n$ l& E- R0 P4 c
my.cnf :
+ T. u1 n d2 ]7 ?. X3 f# D1 log-error=/var/log/mysqld.log //亥摮曆蝵$ o- y K3 q1 K
2 connect_timeout = 15 //蝺timeout
+ r: [$ w$ A# |: y/ I3 max_connections = 3000 //憭折蝺% E" p1 @$ Y6 p
4. service mysqld restart
2 m1 d y `6 w) g, q
8 B& s) P: c! h" Q, d, ^+ A! p3 p8 k/ a* @0 g* x" A K
C.
, L* m& N0 o0 R7 N- W+ W4 d/ W閮剖 MySQL 鞈摨怎恣 root 撣單嗥撖蝣潘瑁sudo mysql_secure_installation嚗隞雿摨銝撟曆辣鈭! J$ }4 H& H# Z3 |5 K
1. Enter current password for root (enter for none): // 湔交 Enter嚗粹閮剜撖蝣, w( c% V' i Y
2. Set root password? [Y/n] //頛詨 Y 靘閮剖撖蝣- ^6 W" w5 w+ v
3. New password: // 頛詨 root 啣蝣- q3 i2 m, x1 B; C& l
4. Re-enter new password: // 銝甈∟撓 root 啣蝣% m4 u) N: e' |. P) K# I
5. Remove anonymous users? [Y/n] //閮 Yes 嚗湔交 Enter
5 ?; }6 P5 K6 ]% E+ L- e* {5 l6. Disallow root login remotely? [Y/n] //閮 Yes 嚗湔交 Enter9 e5 e u+ W) s5 U
7. Remove test database and access to it? [Y/n] //閮 Yes 嚗湔交 Enter
9 A% a# \: {) O6 S/ l8. Reload privilege tables now? [Y/n] //閮 Yes 嚗湔交 Enter
8 u. n1 _8 d( A( n4 n2 }/ N, a, L ~4 l: M) b+ T0 r4 h4 C0 e
" R1 q% }, e1 s. I亥拍典閮剖 root 撖蝣潛餃 MySQL嚗瑁sudo mysql -u root -p嚗撖蝣潭迤蝣箏停脣乓mysql>璅蝷箇泵9 ]* P' L/ [5 g4 E: i
瑁豢閬券鞈摨
8 D. c6 C9 S. L# [mysql> use mysql
5 d. \! d0 b$ |/ Q4 D/ |# B2 b* R. J9 A
瑁select host,user from user ;閬蝯撠暹瑁: }, H3 p* R( {1 f" l
mysql> select host,user from user ;1 C: Y' K, b# ?1 [9 p
+-----------+------+6 `' \; E. j ^
| host | user |
; m" Z8 B1 ^1 j- P+-----------+------+
$ |* |" t4 i! H; s9 g' l| 127.0.0.1 | root |
3 @) E3 B! g1 p7 l| localhost | root |0 Q+ o* w% j- J4 d& O, j
+-----------+------+9 f: k/ a5 n3 W: S, Y% g( B% h
2 rows in set (0.00 sec)/ h6 I4 @8 i6 o; p# H. i
8 w( \0 W6 A$ ]3 X 啣銝雿輻刻
, c. S3 W0 o# L: x: I9 ?- Ninsert into user (host,user,password) values ('%','your_account',password('your_password'));
! y, t' [# b8 A1 X6 m. |, }; D' }
! |" i7 Z! M/ G" F+ r( }餅閰脖蝙刻蝞∠甈嚗璅雿賣颲行蝡航 嚗 root 蝡舐餃亥◤鈭嚗 : X6 p) E; z" X+ n9 h+ B2 C
GRANT ALL ON *.* TO 'your_account'@140.112.1.1 IDENTIFIED BY 'your_password' WITH GRANT OPTION;$ p+ F1 }2 C$ z
銝嗅撣唾嚗芣臭祈摨思蝙刻撣唾嚗銝瘝隞颱甈
6 h( H& n2 ^7 `- f* N" s! ^8 U6 Q3 W餉閮剖# G# L# s2 X0 L" J
FLUSH PRIVILEGES;/ t3 G( w& `: S2 W
摰鋆摰Phpmyadmin ,run http://www.domain.com/dbadmin show error : The mbstring extension is missing. Please check your PHP configuration.
( I- K# i- }# Y$ Z9 I隢摰鋆
1 U. {0 \# Z( |: v7 F
F/ B2 G8 K0 j; ?. M! i! v! f1 Myum -y install php-mbstring
; w4 \) p, @& D, @, [# \: o. c+ ?. R" x! R8 e7 y3 j @0 t. B' } T1 v
亙箇曄撩撠mcrypt嚗隢摰鋆
+ B: v) g( p8 D8 l6 e' W$ X
w$ w& q3 V& n' ~/ K$ x( }yum -y install mcrypt4 u( s! [, z$ T# P: Q
service nginx restart! N f& O3 n5 D% {2 T/ J/ m% R( y/ o _
Login phpadmin 敺箇 error:蝻箏 mysqli 游憟隞嗚隢瑼X PHP 閮剖Solution:# o& I" ~2 e1 {" O$ G
php -m | grep mysqli ===> confirm mysqli module is installed
/ s8 w% _# }9 ] a6 v- Rphp -i | grep extension_dir ===> 撠曉辣隡貊桅6 l5 G# r( H9 w( h" ?
yum -y install php-mysql ( yum install php5-mysqli) ===> ok
9 M: w1 @( ~1 a蝻箏 mcrypt 游憟隞嗚隢瑼X PHP 閮剖1 C9 V1 b8 \/ J4 S! G
yum install php-mcrypt1 F+ o8 g- x4 N! i5 q3 a
yum install libmcrypt libmcrypt-devel ===> ok: \3 [( J6 `# l" n
# A4 W/ H7 I2 W4 [
+ ]2 h5 l7 t5 {( l |
|