|
|
Warning: World-writable config file '/etc/my.cnf' is ignored. S' Y/ S. f! O5 \8 D
1.本地登录MySQL授权:5 W8 x) {( U+ A) F) e" {1 a2 n
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456789' WITH GRANT OPTION;
6 j. [2 s/ D- t( _--给用户root密码123456的账户授权所有电脑都可以连接的权限9 D* ]$ s$ S) t$ |
2.执行 flush privileges;命令立即生效( N- `2 w1 X6 g# w) W. }( v' P
3.使用exit命令退出MySQL) {# y: @: E8 j H) f
然后打开vim /etc/mysql/my.cnf' P" s1 t+ v( d# {
将bind-address = 127.0.0.1 设置成bind-address = 0.0.0.0(设备地址,仅支持IPv4的TCP/IP的连接)7 G1 v( w, i7 q: A& j# ?; B& A
将bind-address = 127.0.0.1 设置成bind-address = ::(同时支持IPv4和IPv6的TCP/IP的连接)
6 Z. C1 I. b! q! n% G4 \2 Z重新启动(命令如下):" h5 B) Z/ b) }* R; m& V
service mysqld stop( {8 P. R) m3 d
service mysqld start
8 M; x! i9 R7 `$ D注意:如果my.cnf无权限,对my.cnf授权777权限后2 [3 e$ L! }# r/ F+ V ? o
重启mysql报错:Warning: World-writable config file '/etc/my.cnf' is ignored 9 ]* T- U4 S$ o; ]6 h( e3 P" c! Q
原因:权限777,任何一个用户都可以改my.cnf,存在很大的安全隐患.. I; `8 e; W# g( b% d$ P' G0 a- o
解决方法:
# L c& B/ [; x, J授权644权限 chmod 644 /etc/my.cnf, i6 h9 \1 o- m" g7 C4 S2 _
重启mysql服务
* B, s. `) |1 D1 pservice mysqld restart9 u5 E* B0 k+ C" M: f
0 L9 T, q2 u6 N |
|