摰鋆摰Mysql 敺閮剖 :- J- C! I. |1 p: M
脖甇亥身摰 MySQL
J4 U. ]; l+ H5 S& K6 AA.4 G/ x" z$ e2 r0 |! q5 X
閮剖php.ini(/etc/php.ini)' {; A/ z H1 o4 j, y$ Z9 ?
php.ini
7 H7 \- I1 _9 w8 X1 memory_limit = 128M //PHP舐刻園銝: ? l& {+ C- W9 M) k7 {3 B3 v( o% u
2 display_errors = Off //憿舐內航炊閮
! S: B7 U6 O- _3 date.timezone = Asia/Taipei //(銵閬閮剖嚗銝賀HP雿輻典唳賣豢航炊閮)
?* D0 Y' \7 l' J+ H4 session.cookie_lifetime = 0 //session摮瘣餅(桐蝘嚗0隞銵典瘣餉喟閬賢券)& o2 U% G/ K9 }' j) d7 Z6 _( P( r
_/ {1 A7 S9 X; y5 O' mB." ?; b0 H1 P3 X
閮剖my.cnf(/etc/my.cnf)9 G$ f2 p' s# c' `
my.cnf :
, ^4 H, Q. h# J4 U& L* Z9 g* O R1 log-error=/var/log/mysqld.log //亥摮曆蝵
, P, w, `0 f6 e" h2 connect_timeout = 15 //蝺timeout2 e E; e# j& z- `+ A) q) S
3 max_connections = 3000 //憭折蝺$ l: G5 M/ _9 y- e# H
4. service mysqld restart, h" u3 F. t: r9 `9 t; ?% y5 O
% g) o* H% t) t# y8 H4 Y; Q- r3 q# o3 `+ `4 F+ t
C.
' s7 ~, x& b2 m8 }5 Q- g2 P閮剖 MySQL 鞈摨怎恣 root 撣單嗥撖蝣潘瑁sudo mysql_secure_installation嚗隞雿摨銝撟曆辣鈭
% a, U; m% X/ m: z' c% P5 s7 E4 h1. Enter current password for root (enter for none): // 湔交 Enter嚗粹閮剜撖蝣8 S0 f/ @9 V4 T3 Y* x% g+ K7 ^
2. Set root password? [Y/n] //頛詨 Y 靘閮剖撖蝣( @* q" m9 A3 _% M m
3. New password: // 頛詨 root 啣蝣9 _& W( Y1 p5 D0 d8 v/ r5 U! Z1 a
4. Re-enter new password: // 銝甈∟撓 root 啣蝣# N0 v3 ^" ]9 |# ~0 b
5. Remove anonymous users? [Y/n] //閮 Yes 嚗湔交 Enter8 R' R8 z) e- z) w
6. Disallow root login remotely? [Y/n] //閮 Yes 嚗湔交 Enter+ I" d }! x( @! B& X. S" E
7. Remove test database and access to it? [Y/n] //閮 Yes 嚗湔交 Enter
# o% B {3 A. Z f# p. U d P8. Reload privilege tables now? [Y/n] //閮 Yes 嚗湔交 Enter
! w7 j C% O8 v$ T3 R: S+ y
5 b7 G& T" c8 c! |2 c& `4 ]
) e1 P+ G0 x& R; E) q% A" x3 K; v亥拍典閮剖 root 撖蝣潛餃 MySQL嚗瑁sudo mysql -u root -p嚗撖蝣潭迤蝣箏停脣乓mysql>璅蝷箇泵
/ X4 W$ c3 d( ?& D& } 瑁豢閬券鞈摨+ D x- O& U) B; C8 ~
mysql> use mysql# h' [" V4 L3 q8 H8 R
9 s; X k) O9 ?
瑁select host,user from user ;閬蝯撠暹瑁
% A$ {% k/ ~! f( q o, W% [; umysql> select host,user from user ;* M0 d4 w( W: V A
+-----------+------+# N/ A1 _# ^% X# J6 c
| host | user |
" s6 ^ }( L6 ?; s+-----------+------+# n' ~/ Y0 R$ Z
| 127.0.0.1 | root |
3 d, e2 m, y1 r$ J| localhost | root |
/ w; ?2 j" k0 f+ A& H7 y+-----------+------+- q& X- x7 Z$ x3 {, Z+ e$ v1 v
2 rows in set (0.00 sec)1 U% l; Z+ R5 N8 U# Z7 D
9 G. t$ `, [6 m4 s' V
啣銝雿輻刻8 s5 p) J9 B6 t
insert into user (host,user,password) values ('%','your_account',password('your_password'));- F' O8 j9 n; N% T$ w$ u0 v% N5 J
: m( d% }8 Z5 v5 ]" h, W1 i- i餅閰脖蝙刻蝞∠甈嚗璅雿賣颲行蝡航 嚗 root 蝡舐餃亥◤鈭嚗
3 @! h9 l7 {# WGRANT ALL ON *.* TO 'your_account'@140.112.1.1 IDENTIFIED BY 'your_password' WITH GRANT OPTION;
& f3 }/ t# c' b銝嗅撣唾嚗芣臭祈摨思蝙刻撣唾嚗銝瘝隞颱甈0 {) I. Q" |# S) v/ J! B0 k
餉閮剖
/ {) y% `9 t4 Q& `0 M" {FLUSH PRIVILEGES;! w3 D. ?, ?! j7 q: I
摰鋆摰Phpmyadmin ,run http://www.domain.com/dbadmin show error : The mbstring extension is missing. Please check your PHP configuration.& H( \& S; E8 R9 D6 K$ X
隢摰鋆
2 B* R& m. i, Y$ E2 v3 u
# Q1 ^$ |2 A% ?6 V1 k) e2 kyum -y install php-mbstring! H2 k, V# T, x% V5 o" f
+ ^1 f/ E+ M' U4 M6 j D; l: i2 M亙箇曄撩撠mcrypt嚗隢摰鋆
6 u8 u* i% R* R' r 7 g* l$ V9 t9 R- D
yum -y install mcrypt1 X$ K% r. x6 G
service nginx restart. s" t0 Z( b- X# [
Login phpadmin 敺箇 error:蝻箏 mysqli 游憟隞嗚隢瑼X PHP 閮剖Solution:
9 g6 G3 Q0 }$ f" q: G5 `/ tphp -m | grep mysqli ===> confirm mysqli module is installed! u! u6 }- z) o
php -i | grep extension_dir ===> 撠曉辣隡貊桅' @' c4 h& \, o0 p
yum -y install php-mysql ( yum install php5-mysqli) ===> ok
7 v, c. x' o2 |9 t! ~' @蝻箏 mcrypt 游憟隞嗚隢瑼X PHP 閮剖5 l, ]" `. |5 b3 N& i5 ]
yum install php-mcrypt4 ~0 y* n8 {1 R" h
yum install libmcrypt libmcrypt-devel ===> ok
( q: I& t: M% v. |
7 e) S% f0 u8 k. i: }) `" m/ i' m- U# P5 j4 {; v# R- W; m: R% ~) P# D
|
|