摰鋆摰Mysql 敺閮剖 :
4 h! v0 u& _! X2 |6 j& a! V5 x2 k脖甇亥身摰 MySQL# i) I2 A% s4 o9 [# V% K
A.# Q* p1 _9 Q" ]' q1 l. k& [
閮剖php.ini(/etc/php.ini)# }- l5 P0 D/ |& e- g! B9 Y
php.ini
+ ] D0 G' a6 {7 V% x1 memory_limit = 128M //PHP舐刻園銝
: Y0 d, V8 N3 Z" S5 T2 display_errors = Off //憿舐內航炊閮
% K# H( w3 w1 m5 ^, b$ ]8 b3 date.timezone = Asia/Taipei //(銵閬閮剖嚗銝賀HP雿輻典唳賣豢航炊閮). H7 a- c, |9 }6 b) G$ r2 ^
4 session.cookie_lifetime = 0 //session摮瘣餅(桐蝘嚗0隞銵典瘣餉喟閬賢券)* M! h7 A( i# C5 i
: X% Y# d; {3 R* S. `/ L2 T& C/ \B.
|. ]( x0 V4 C+ V閮剖my.cnf(/etc/my.cnf)
8 F* f0 x& a9 Y0 P/ @! L/ k8 cmy.cnf : # a1 G" O" x/ e% j3 c' q0 {$ A- D
1 log-error=/var/log/mysqld.log //亥摮曆蝵. T3 G1 O7 E4 T' b- J2 S/ q0 H
2 connect_timeout = 15 //蝺timeout4 y* k5 W7 R7 o6 A4 p, E
3 max_connections = 3000 //憭折蝺' M% w2 y& N7 S1 T
4. service mysqld restart: k6 U- c M; S! E& z& u( u
* a0 a m% l+ c v: g6 |
6 F7 u" w; Y4 U( Z% VC.& `- v( O8 K c9 J3 u6 H6 V
閮剖 MySQL 鞈摨怎恣 root 撣單嗥撖蝣潘瑁sudo mysql_secure_installation嚗隞雿摨銝撟曆辣鈭4 r- X& |9 c G# i8 U3 r
1. Enter current password for root (enter for none): // 湔交 Enter嚗粹閮剜撖蝣
- n: N" g( A% q; q* C$ s$ _% Z2. Set root password? [Y/n] //頛詨 Y 靘閮剖撖蝣2 A5 f1 o) N) z7 c7 {1 b/ F
3. New password: // 頛詨 root 啣蝣
+ T5 d0 d4 J5 C7 m) p. V4. Re-enter new password: // 銝甈∟撓 root 啣蝣+ g- o& o8 `& S; a: Q0 }$ _
5. Remove anonymous users? [Y/n] //閮 Yes 嚗湔交 Enter# R" ~3 [8 u9 B1 B1 h, {: R3 t" o7 m
6. Disallow root login remotely? [Y/n] //閮 Yes 嚗湔交 Enter
~( v9 Y: k8 d& u: i! J! H7. Remove test database and access to it? [Y/n] //閮 Yes 嚗湔交 Enter
0 L8 v0 ^% r; T0 n5 Q8. Reload privilege tables now? [Y/n] //閮 Yes 嚗湔交 Enter
$ K0 R( _) T. e- O; d% o! J; R, U: C4 d7 j/ {
; s; C" f1 C$ [9 Z6 W- u& t. K3 u
亥拍典閮剖 root 撖蝣潛餃 MySQL嚗瑁sudo mysql -u root -p嚗撖蝣潭迤蝣箏停脣乓mysql>璅蝷箇泵1 p- W, g- F9 |/ n) C; B6 N
瑁豢閬券鞈摨
6 {- V. T9 c& Q1 X. e/ ]5 amysql> use mysql
3 k& E6 t& {2 ]0 m$ e+ b# A; v$ e" `) u
瑁select host,user from user ;閬蝯撠暹瑁; g' d9 n& |) i9 o) q, j# B# s
mysql> select host,user from user ;
( y: a# S6 Q0 d& z9 g+-----------+------+; b. u. Q( H5 S+ h
| host | user |4 I; S/ \$ E; ~6 u& X9 R
+-----------+------+
/ { s- G5 ?2 J$ C0 K `| 127.0.0.1 | root |5 `1 \1 t% i1 \4 K4 I
| localhost | root |
7 _0 f b" ]. c7 I+-----------+------+
5 o8 E4 N% V8 N/ a s$ W- j& Y) }2 rows in set (0.00 sec)2 z5 A4 b7 ?" S+ s( ?% i1 A, g$ J) d7 G! q
6 E! `: S" s C. Z4 o 啣銝雿輻刻
8 V# Y& |% V; k& z1 }5 d# E7 Rinsert into user (host,user,password) values ('%','your_account',password('your_password'));, k) f7 ?% K8 }5 ~3 h0 {
( f# T/ H+ ]9 V8 l, |/ l& x餅閰脖蝙刻蝞∠甈嚗璅雿賣颲行蝡航 嚗 root 蝡舐餃亥◤鈭嚗
" Y. m+ K/ Y2 a* ^0 A! C, {GRANT ALL ON *.* TO 'your_account'@140.112.1.1 IDENTIFIED BY 'your_password' WITH GRANT OPTION;
" c' |3 ~+ @. N2 V. r, P* E銝嗅撣唾嚗芣臭祈摨思蝙刻撣唾嚗銝瘝隞颱甈 ]5 x; v# F: S. g
餉閮剖
: [. E) ]% D- @- W' bFLUSH PRIVILEGES; I' F7 A) P) `1 _& z
摰鋆摰Phpmyadmin ,run http://www.domain.com/dbadmin show error : The mbstring extension is missing. Please check your PHP configuration.
- e! }4 {, G m0 y- M) f4 ?隢摰鋆
; `6 W5 l% S4 B' L 9 |( {, n$ N1 Y) s) l) S+ I; ?" u
yum -y install php-mbstring5 v8 g7 F' W0 L4 o5 B
2 O& {' e1 X! ~
亙箇曄撩撠mcrypt嚗隢摰鋆
6 w( c, @0 Z7 ~ 0 g) H. X* u7 r+ u) z4 s2 t
yum -y install mcrypt5 {* `, d# o* |* v
service nginx restart
* K" i2 ~- ~2 M- } e; \Login phpadmin 敺箇 error:蝻箏 mysqli 游憟隞嗚隢瑼X PHP 閮剖Solution:
+ x: t T: X* A* c* Xphp -m | grep mysqli ===> confirm mysqli module is installed6 c( n5 I* K, p2 \
php -i | grep extension_dir ===> 撠曉辣隡貊桅( r* k$ _4 `( p6 w1 r
yum -y install php-mysql ( yum install php5-mysqli) ===> ok# Z6 n+ ] u" O
蝻箏 mcrypt 游憟隞嗚隢瑼X PHP 閮剖
0 p' I# V, a" G% cyum install php-mcrypt
+ _. B2 T/ g; `. A' X$ ]3 tyum install libmcrypt libmcrypt-devel ===> ok
, G& F, n( { z( O6 Y- r
( W% z4 Z7 h; c& G- v: y
0 ?% R% {- F2 U% q |
|