摰鋆摰Mysql 敺閮剖 :
3 I8 n. y4 B5 U: P; _3 c0 U脖甇亥身摰 MySQL
) r1 {0 z" f. Y* ]! F) @A.8 c5 m4 F$ @; j+ C" r9 G
閮剖php.ini(/etc/php.ini)
) |3 L( }* `, M6 U4 }4 iphp.ini
: {" L" p9 D. D8 t% y1 memory_limit = 128M //PHP舐刻園銝" \% d6 ^7 C c: j5 g
2 display_errors = Off //憿舐內航炊閮
, S' T0 \+ s1 Z( A3 date.timezone = Asia/Taipei //(銵閬閮剖嚗銝賀HP雿輻典唳賣豢航炊閮)
9 j. d( a, ^' Z+ \ A; @; u4 session.cookie_lifetime = 0 //session摮瘣餅(桐蝘嚗0隞銵典瘣餉喟閬賢券)
6 L; F3 s! _* f* {4 O# S9 v$ f# [* [+ w7 Q+ `7 j
B.5 |* h& _( ?9 |9 e
閮剖my.cnf(/etc/my.cnf)6 d6 k, ^- t P' P
my.cnf :
5 I+ o# u6 I: q; f1 log-error=/var/log/mysqld.log //亥摮曆蝵/ z/ U: ^$ {* C0 o" J1 `6 _
2 connect_timeout = 15 //蝺timeout& \7 q9 u' s0 }3 G f
3 max_connections = 3000 //憭折蝺9 G3 I, Q% ?* T& D( n4 E
4. service mysqld restart
, \! A3 {+ B7 O$ `. j
4 a: ^0 f4 M. G' T' c% M
6 D1 X" n# V* [1 r) v0 `C.# q2 V! J y* {
閮剖 MySQL 鞈摨怎恣 root 撣單嗥撖蝣潘瑁sudo mysql_secure_installation嚗隞雿摨銝撟曆辣鈭; W" A+ U' }8 q9 r! a" M- I2 k
1. Enter current password for root (enter for none): // 湔交 Enter嚗粹閮剜撖蝣2 T3 Z! ]7 o, [7 ]
2. Set root password? [Y/n] //頛詨 Y 靘閮剖撖蝣, R% Q8 X- r; G$ w
3. New password: // 頛詨 root 啣蝣) h, z0 A/ F2 b) }
4. Re-enter new password: // 銝甈∟撓 root 啣蝣7 ` L: `2 U' V- k
5. Remove anonymous users? [Y/n] //閮 Yes 嚗湔交 Enter% ^" E# [/ J0 `2 g4 u$ d
6. Disallow root login remotely? [Y/n] //閮 Yes 嚗湔交 Enter
! u) b0 e" c, S2 Z# g7. Remove test database and access to it? [Y/n] //閮 Yes 嚗湔交 Enter
. z7 k8 L1 v; ?; L H! r4 E/ ~8. Reload privilege tables now? [Y/n] //閮 Yes 嚗湔交 Enter
$ F* B1 ?" D5 r' n
. A9 X& f/ {. P" S# U0 R
3 @( o+ L) `4 X9 T4 S: \7 R+ ?亥拍典閮剖 root 撖蝣潛餃 MySQL嚗瑁sudo mysql -u root -p嚗撖蝣潭迤蝣箏停脣乓mysql>璅蝷箇泵
8 L. E& W; c+ M. V0 f$ c; {! u 瑁豢閬券鞈摨
9 M, E/ |7 Z+ N% pmysql> use mysql
0 H& m& _! R3 g: k! K& d+ L7 b' T r/ C9 k3 r/ k
瑁select host,user from user ;閬蝯撠暹瑁
" T4 Z ^; w% Q9 m/ Cmysql> select host,user from user ; Z% J! Z; Q) m' c6 P: N
+-----------+------+ L1 \' @/ A2 }5 y; ?/ t
| host | user |, \3 F' N! \) F7 D: }
+-----------+------+
# C; D5 e+ i8 C| 127.0.0.1 | root |
3 H0 ]" k, Y/ P6 Q2 t9 G; q| localhost | root |
3 @$ |. t+ p& U! p$ i+-----------+------+
1 ]! Y y1 i: D; d2 rows in set (0.00 sec)
: y% Y5 j9 P. z4 d u g$ P8 g
. X% Q( \ \1 G- j 啣銝雿輻刻# J- Y4 k$ m) W/ Q' o
insert into user (host,user,password) values ('%','your_account',password('your_password'));
# z6 L. `0 u, J
7 y7 G$ u& L: C7 X" d餅閰脖蝙刻蝞∠甈嚗璅雿賣颲行蝡航 嚗 root 蝡舐餃亥◤鈭嚗
% N1 a: ~$ L" n- ?9 A6 `+ @$ jGRANT ALL ON *.* TO 'your_account'@140.112.1.1 IDENTIFIED BY 'your_password' WITH GRANT OPTION;
: n+ O: F. U, B9 d銝嗅撣唾嚗芣臭祈摨思蝙刻撣唾嚗銝瘝隞颱甈
) B! S, t8 E* ?+ U% D# f, |餉閮剖
4 K, X* N3 v: V( g! a4 gFLUSH PRIVILEGES;5 U" K( s4 G" p4 x a: ? r6 T
摰鋆摰Phpmyadmin ,run http://www.domain.com/dbadmin show error : The mbstring extension is missing. Please check your PHP configuration.& h9 S- U( {0 m5 F- c; C# e; ]
隢摰鋆7 K3 K$ x3 k3 s( u
+ p6 ?" Q c$ z! n$ V' c" \
yum -y install php-mbstring
( M: r0 @0 a# d( k0 E4 W( h
0 a* s/ L; t6 I# _* h1 R; Y/ v亙箇曄撩撠mcrypt嚗隢摰鋆
9 G0 C) m- G/ p/ ]1 E
" a5 |6 K2 M6 l: _! N fyum -y install mcrypt' H: u% R+ v2 d
service nginx restart
! Y* q$ x$ a7 }9 U1 M& QLogin phpadmin 敺箇 error:蝻箏 mysqli 游憟隞嗚隢瑼X PHP 閮剖Solution:
+ l( h9 j) B. _1 x* Iphp -m | grep mysqli ===> confirm mysqli module is installed
7 v. P/ n# u! ephp -i | grep extension_dir ===> 撠曉辣隡貊桅+ |$ d# O! F% O* ~$ Y
yum -y install php-mysql ( yum install php5-mysqli) ===> ok: t2 E5 f i! s7 s, g5 A j
蝻箏 mcrypt 游憟隞嗚隢瑼X PHP 閮剖
; |: ?1 I: w' d0 l; yyum install php-mcrypt
! g* L2 z- X& N3 G7 ` myum install libmcrypt libmcrypt-devel ===> ok8 o3 T( C E- `8 O9 A: e4 @( x- o
" g" d' b8 r8 Y. w- L: L- p
j# j4 e; A& i# F8 n |
|