摰鋆摰Mysql 敺閮剖 :
D" T/ i+ S d5 z, R( R/ M脖甇亥身摰 MySQL! U9 Q7 S8 w# m3 Q
A.
; x6 c) L: t9 U7 z; ~閮剖php.ini(/etc/php.ini)
. Q$ e' `" [4 b: ~6 w) Wphp.ini
* ~0 G- W# X3 \9 N& n. k! ~3 a1 memory_limit = 128M //PHP舐刻園銝- q2 A Q5 W, M% r' F7 }
2 display_errors = Off //憿舐內航炊閮6 m* M3 r( ]1 b4 I) Z
3 date.timezone = Asia/Taipei //(銵閬閮剖嚗銝賀HP雿輻典唳賣豢航炊閮)
3 Y8 N0 o7 k+ }& ?1 [4 session.cookie_lifetime = 0 //session摮瘣餅(桐蝘嚗0隞銵典瘣餉喟閬賢券)
& N3 H4 N$ E6 h9 q( V+ [: j
8 A% C1 S2 y* E4 iB.
% S2 O3 @2 t* m! `# Y1 t& e- X閮剖my.cnf(/etc/my.cnf)6 L( } d) I' Q& N! R5 {: w
my.cnf :
2 B n% y$ ^ s6 W1 log-error=/var/log/mysqld.log //亥摮曆蝵- `, V- V( W" M
2 connect_timeout = 15 //蝺timeout/ o Z$ j& z! G
3 max_connections = 3000 //憭折蝺
0 k5 c" C6 d# u$ J& b4. service mysqld restart
: V' j& O# B- ]* ~- M
' N; W5 h9 \3 ?" N2 y- ?1 {5 P( y2 j; E
C.
. u+ c# P9 G9 u9 {- x4 ~! e2 I/ J閮剖 MySQL 鞈摨怎恣 root 撣單嗥撖蝣潘瑁sudo mysql_secure_installation嚗隞雿摨銝撟曆辣鈭
! G$ k& Q9 G K4 k$ a1. Enter current password for root (enter for none): // 湔交 Enter嚗粹閮剜撖蝣
( }- }0 Y9 |$ r/ f* y2 A1 I2. Set root password? [Y/n] //頛詨 Y 靘閮剖撖蝣1 w/ a; m0 @# l
3. New password: // 頛詨 root 啣蝣
3 _! H8 P) `' D$ O& ?' U4. Re-enter new password: // 銝甈∟撓 root 啣蝣+ X9 ~- x) l7 M* R& N, t) p
5. Remove anonymous users? [Y/n] //閮 Yes 嚗湔交 Enter; \9 N9 L$ |5 z/ s! a
6. Disallow root login remotely? [Y/n] //閮 Yes 嚗湔交 Enter
$ Z: U) t z7 G2 e2 `7. Remove test database and access to it? [Y/n] //閮 Yes 嚗湔交 Enter- a9 G1 \ N2 r! E6 j2 S& _
8. Reload privilege tables now? [Y/n] //閮 Yes 嚗湔交 Enter; Q- F4 v9 C" ^1 U
% m$ v$ Y# l1 V! b V/ e7 H) w1 S" [0 C
亥拍典閮剖 root 撖蝣潛餃 MySQL嚗瑁sudo mysql -u root -p嚗撖蝣潭迤蝣箏停脣乓mysql>璅蝷箇泵
; P" i& R( O8 F7 y 瑁豢閬券鞈摨
' u) i) F) Y. E5 i- }+ v( Nmysql> use mysql
, u& c0 O6 I. f8 c% C. e+ P1 B7 F& C1 j( a9 W
瑁select host,user from user ;閬蝯撠暹瑁 |& n- u7 n! b' m6 z: X$ x- ^6 x7 q0 M* z
mysql> select host,user from user ;
w3 D _% _" l; g+ Y) Q+-----------+------+
8 c0 i, @! O, n" t) e8 W' I2 h0 _# b| host | user |/ a" |* R: E8 Q' x- t
+-----------+------+' t! i2 L, G l$ D1 x
| 127.0.0.1 | root |
5 a, c* v3 @; l$ m| localhost | root |
* K7 P* x0 }" c* j+-----------+------+
6 M8 E' p: v, y4 e ]$ g7 {" l2 rows in set (0.00 sec)" r* t! ?. @, i& @
8 r+ \3 T! y6 m, |
啣銝雿輻刻* f9 K& x; W: w6 q( T3 d
insert into user (host,user,password) values ('%','your_account',password('your_password'));
; W R7 b: K+ D' U! m
# F4 N* N1 S4 i5 Q/ j餅閰脖蝙刻蝞∠甈嚗璅雿賣颲行蝡航 嚗 root 蝡舐餃亥◤鈭嚗
4 g$ i- b- ]' A. R% b8 q& _GRANT ALL ON *.* TO 'your_account'@140.112.1.1 IDENTIFIED BY 'your_password' WITH GRANT OPTION;
% D3 U( k5 v! H銝嗅撣唾嚗芣臭祈摨思蝙刻撣唾嚗銝瘝隞颱甈" m5 q% Y( ]# f9 H' _: \
餉閮剖
4 b3 ?" P+ ^8 x1 lFLUSH PRIVILEGES;+ G% d: `3 r: D# t$ ]* L2 u9 {
摰鋆摰Phpmyadmin ,run http://www.domain.com/dbadmin show error : The mbstring extension is missing. Please check your PHP configuration., X4 Q2 E% V; v( b+ C3 s
隢摰鋆: o5 o: Q" e5 R, N) _
% J# O8 A, N; S* A- c* Q3 @ t
yum -y install php-mbstring% q# b2 n2 Q8 z {1 R
F5 z% O6 u3 |. I. Z* E' k" p, Q
亙箇曄撩撠mcrypt嚗隢摰鋆
9 E, l) S% Z4 o 1 x- V3 w6 m; I1 R# B
yum -y install mcrypt) ^1 j( @: j" G0 s
service nginx restart0 C) ~4 X0 D6 D; d8 z, k
Login phpadmin 敺箇 error:蝻箏 mysqli 游憟隞嗚隢瑼X PHP 閮剖Solution:
4 a. [$ K" }6 h$ q/ ?php -m | grep mysqli ===> confirm mysqli module is installed3 s( f% m6 X8 b9 u$ A9 S7 p! M
php -i | grep extension_dir ===> 撠曉辣隡貊桅5 \; d; C- H7 ~- l% b" ?$ w
yum -y install php-mysql ( yum install php5-mysqli) ===> ok
t1 F5 j) s5 L, ^, }. W蝻箏 mcrypt 游憟隞嗚隢瑼X PHP 閮剖9 A$ B9 s- G/ L! i6 y6 l* m% l3 g
yum install php-mcrypt" J1 _, M6 t6 t5 `8 C
yum install libmcrypt libmcrypt-devel ===> ok
/ ?9 k6 a6 W* ?) B8 n' H: D& F( D% u
% J6 t4 z0 _) h
|
|