数据库
首页 > 数据库> > MySQL通过远程方式上传数据

MySQL通过远程方式上传数据

作者:互联网

1. 用户授权
create user test@'%' identified by 'mysql';
grant all privileges on testdb.* to test@'%';
flush privileges;
2. 远程上传授权
查询远程上传是否开启:

show global variables like 'local_infile';

远程上传授权:

set global local_infile=ON;

3. 远程登录启用
mysql -h127.0.0.1 -u test -p --local-infile=1 -D testdb
4. 远程上传数据
load data local infile 'D:/test/city.csv' into table city fields terminated by '&' lines terminated by '\n';

标签:上传,global,远程,MySQL,test,local,infile
来源: https://www.cnblogs.com/OrcinusOrca/p/14723379.html