MySQL设置远程连接
基本思路就是为mysql.user表增加一条记录:'Hadoop'@'%',这样,任何主机上的用户'hadoop'都可以远程连接MySQL数据库。于是输入下面的命令:
mysql> INSERT INTO mysql.user(Host,User,Password) VALUES('%','hadoop','1');
结果出现了错误:
1364 - Field 'ssl_cipher' doesn't have a default value
这是因为指定了严格模式,不能直接往mysql.user表里面insert用户:
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
只能输入下面两个命令来实现:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'hadoop'@'%' IDENTIFIED BY '1' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
这样,任何主机上的用户'hadoop'都可以凭借密码'1'远程连接MySQL数据库。
相关推荐
emmm00 2020-11-17
王艺强 2020-11-17
aydh 2020-11-12
世樹 2020-11-11
zry 2020-11-11
URML 2020-11-11
spurity 2020-11-10
yifangs 2020-10-13
Andrea0 2020-09-18
Ida 2020-09-16
ltd00 2020-09-12
tufeiax 2020-09-03
xjd0 2020-09-10
greatboylc 2020-09-10
adsadadaddadasda 2020-09-08
疯狂老司机 2020-09-08
CoderToy 2020-11-16
ribavnu 2020-11-16
bianruifeng 2020-11-16