摰鋆摰Mysql 敺閮剖 :
6 ^/ x, k4 T6 l# h2 G脖甇亥身摰 MySQL$ ~' U' x: y" K% e( O
A./ S1 t0 g/ ]- Y4 Z% ~! g8 W
閮剖php.ini(/etc/php.ini)0 i d. P+ Z. D
php.ini# H$ \6 D1 U( |" `" r+ d" h
1 memory_limit = 128M //PHP舐刻園銝+ |/ X$ Y9 e- U' q
2 display_errors = Off //憿舐內航炊閮
- _* L1 y0 z, F' K' z3 date.timezone = Asia/Taipei //(銵閬閮剖嚗銝賀HP雿輻典唳賣豢航炊閮)
) n c9 b4 R) {( y4 session.cookie_lifetime = 0 //session摮瘣餅(桐蝘嚗0隞銵典瘣餉喟閬賢券)
& x* v& g& O, [ ~. t7 t1 n% H: _1 p
B.
. C3 k+ C8 L; z6 c+ _* A閮剖my.cnf(/etc/my.cnf)
, G; z) S& x X0 a: R: N5 r4 |my.cnf :
% x7 W( ~ _+ J# y& t* [. M6 S; e" s1 log-error=/var/log/mysqld.log //亥摮曆蝵' y. t: V! Z" k U8 E: Y; d
2 connect_timeout = 15 //蝺timeout4 r. d7 N" @; G ^7 ?
3 max_connections = 3000 //憭折蝺
O0 _2 p! q9 y" E4. service mysqld restart4 P+ W) l/ ?6 i# Q4 Q: f' o8 \) t- C
" b, [0 H3 F. [, u; N1 B0 r- V0 j/ P4 j
C.- N2 K1 B2 _5 y H* H3 z
閮剖 MySQL 鞈摨怎恣 root 撣單嗥撖蝣潘瑁sudo mysql_secure_installation嚗隞雿摨銝撟曆辣鈭
& T) x( j8 W' t) T6 {1. Enter current password for root (enter for none): // 湔交 Enter嚗粹閮剜撖蝣; P4 j# \1 a! s8 j7 Q* j. D
2. Set root password? [Y/n] //頛詨 Y 靘閮剖撖蝣
) F: R1 m* O3 b' t3. New password: // 頛詨 root 啣蝣
: w6 `9 P' F) L4. Re-enter new password: // 銝甈∟撓 root 啣蝣% q* h# w e% e9 Y: v! l
5. Remove anonymous users? [Y/n] //閮 Yes 嚗湔交 Enter
6 {6 l9 p) `, z4 R6. Disallow root login remotely? [Y/n] //閮 Yes 嚗湔交 Enter5 [% h/ ^# s8 L! |( ?5 U& N" ?
7. Remove test database and access to it? [Y/n] //閮 Yes 嚗湔交 Enter8 e7 v3 b6 l: y% @) Q1 W# ]6 l+ v
8. Reload privilege tables now? [Y/n] //閮 Yes 嚗湔交 Enter
, {: k; y; b. D" y8 Z8 X
5 g! G S' }7 z- R' ~$ U& d$ ]" R2 c
6 r! p8 r, ]; Q! h: M, ]- H+ F亥拍典閮剖 root 撖蝣潛餃 MySQL嚗瑁sudo mysql -u root -p嚗撖蝣潭迤蝣箏停脣乓mysql>璅蝷箇泵
( o$ B/ s% h! }! G& f; A, m% E* X# i 瑁豢閬券鞈摨
- b! ^& U& V# N* f* _- h) ~mysql> use mysql! T$ I9 P* V$ U( Q$ _( e
2 R; V* d8 I! E* v @0 ?9 w" g+ H
瑁select host,user from user ;閬蝯撠暹瑁
/ Q# Z4 z) V3 ~0 q# gmysql> select host,user from user ;7 O5 F8 ?$ {7 K
+-----------+------++ m' W% }. u; R" Y# w$ G4 t) ^
| host | user |: O7 `, i9 U( f9 y% v/ w
+-----------+------+/ G6 k$ C' o h7 f
| 127.0.0.1 | root |
" ?! e% _9 M5 U# F( |7 E% b ]| localhost | root |
$ k! x5 x$ }& Z2 q5 Z- s4 }0 W A+-----------+------+
% r1 h$ t U+ p7 c2 rows in set (0.00 sec)
8 D! {5 A$ R9 B* x3 ?) J# n/ T
" h9 f1 d2 G# U1 z' r 啣銝雿輻刻
. k) X, t! `- k, Q. kinsert into user (host,user,password) values ('%','your_account',password('your_password'));
e% Y$ L4 b2 P5 X- F2 w- W
0 b7 x, q' D0 r7 |; C# @4 t餅閰脖蝙刻蝞∠甈嚗璅雿賣颲行蝡航 嚗 root 蝡舐餃亥◤鈭嚗
8 P' y: {% Y& _+ o6 T" @GRANT ALL ON *.* TO 'your_account'@140.112.1.1 IDENTIFIED BY 'your_password' WITH GRANT OPTION;# e. V; o4 b: z p3 Z) ?0 V
銝嗅撣唾嚗芣臭祈摨思蝙刻撣唾嚗銝瘝隞颱甈7 i8 f, |) J# M4 j% z) L
餉閮剖
1 c) y$ T' k* c% K1 [; nFLUSH PRIVILEGES;
# l2 V/ T" B+ y, i1 | m& a" u' t摰鋆摰Phpmyadmin ,run http://www.domain.com/dbadmin show error : The mbstring extension is missing. Please check your PHP configuration.
" Q6 X* d L+ f* s3 Z) U( U隢摰鋆& N9 T! c$ O8 C' I2 E3 U" B! g
u* y4 e! b4 N
yum -y install php-mbstring" M) |; ?% L$ j. S
& q3 I+ X h! ?) |. o
亙箇曄撩撠mcrypt嚗隢摰鋆
. i# I' j/ z1 ^
7 V0 v n) m1 m7 l) l" @yum -y install mcrypt
( ^8 p$ j. l+ B! M' @service nginx restart$ G, W; N5 n$ z- i/ L3 y9 r
Login phpadmin 敺箇 error:蝻箏 mysqli 游憟隞嗚隢瑼X PHP 閮剖Solution:
+ i. d. B) D* `+ Ophp -m | grep mysqli ===> confirm mysqli module is installed1 O4 {/ N4 ~1 F; V6 f( Q
php -i | grep extension_dir ===> 撠曉辣隡貊桅3 T/ ~- x9 Z# V/ t+ P4 f
yum -y install php-mysql ( yum install php5-mysqli) ===> ok
+ V$ h* f* V% h4 N9 W蝻箏 mcrypt 游憟隞嗚隢瑼X PHP 閮剖
4 [/ C6 S9 d5 Pyum install php-mcrypt6 d$ }5 l. h1 D' T- \
yum install libmcrypt libmcrypt-devel ===> ok1 J- E/ u/ u( g/ A. Y7 E t
3 H4 [1 I. A g* s
! ^ @5 D3 Q' e" l+ I* ?
|
|