MySQL通过远程方式上传数据

1. 用户授权

create user 'test'@'%' identified by 'test123456';
grant all privileges on testdb.* to test@'%';
flush privileges;

2. 远程上传授权

查询远程上传是否开启:

show global variables like 'local_infile';

远程上传授权:

set global local_infile='ON';

3. 远程登录启用

mysql --local-infile=1 -D testdb -u test -p

4. 远程上传数据

load data local infile 'D:/test/city.csv'
into table city
fields terminated by '&'
lines terminated by '\n';

 

©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页