如何設(shè)置其他IP地址可以訪問(wèn)linux本機(jī)安裝的mysql服務(wù)
首先
,
以
root
進(jìn)入
mysql
,
創(chuàng)建遠(yuǎn)程訪問(wèn)用戶
remote,
這個(gè)用戶除了有遠(yuǎn)程訪問(wèn)權(quán)限外
,
還據(jù)有于
root
相同的其他權(quán)限
.
iu VASg3T
?
$ mysql -u root -p
;b Yc{N1
?
Enter password:
Cw8-}&lC
?
Welcome to the MySQL monitor. Commands end with ; or \g.
(zbV/ ^W V
?
Your MySQL connection id is 67 to server version: 4.0.18
~U{r *
?
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
[[j8)_YW#
mysql
>
sM1*B^fn
?
mysql
> GRANT ALL ON *.* TO root@'%' IDENTIFIED BY 'mysql' WITH GRANT OPTION;
kk
*J7
?
Query OK, 0 rows affected (0.04 sec)
)khi(8[1]^
?
mysql
>
mD0h|-Cg
?
對(duì)
GRANT
語(yǔ)句的簡(jiǎn)單說(shuō)明:
GRANT
ALL???????????
所有權(quán)限
ON *.*??????
在所有的數(shù)據(jù)庫(kù)上
TO root@’%’???
對(duì)
root
用戶,在所有其他
IP
上的
root
用戶(注:
mysql
按照用戶名和所在
IP
區(qū)分用戶,所以
root
和
root@%
不是同一個(gè)用戶)
IDENTIFIED BY ‘mysql’?????
口令為
mysql
然后修改
mysql
配置文件讓它監(jiān)聽(tīng)外部
ip
端口
,
修改
/etc/my.cnf
文件中的一下部分
:
# keep secure by default!
gjL|8s]
?
bind-address = 127.0.0.1
K C:c?J
?
port = 3306
Wj
{~D2,
?
把
bind-address = 127.0.0.1
注釋掉即可
a