临时

ALTER USER root@'%' IDENTIFIED BY 'trading';


set password for root@localhost = password('trading');

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'trading' WITH GRANT OPTION;


1.查看端口被哪个程序占用
sudo lsof -i tcp:port
如: sudo lsof -i tcp:6399
2.看到进程的PID,可以将进程杀死。
sudo kill -9 PID
如:sudo kill -9 3210

 

@Test
public void e(){
String url = "http://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLqFpcia3KzB8xZYDFUI1D6y6nVSK0Yy4ibb2tDib8f3UeT6Y3sw44aovURoWkRYZfIbThgRYZjSqyHQ/132";
try {
String parentPath = "/Users/zplogo/dev";
String uuid = UUID.randomUUID().toString();
uuid = uuid.replace("-", "");

String targetFilePath = "/" + uuid + ".jpg";

Path path = Paths.get(parentPath, targetFilePath);

InputStream in = getImageStream(url);
Files.createDirectories(path.getParent());
Files.copy(in, path);
} catch (IOException e) {
e.printStackTrace();
}
}

/**
* 获取网络图片流
*
* @param url
* @return
*/
public InputStream getImageStream(String url) {
try {
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
connection.setReadTimeout(5000);
connection.setConnectTimeout(5000);
connection.setRequestMethod("GET");
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
InputStream inputStream = connection.getInputStream();
return inputStream;
}
} catch (IOException e) {
System.out.println("获取网络图片出现异常,图片路径为:" + url);
e.printStackTrace();
}
return null;
}

posted on 2020-02-02 10:40  ${}  阅读(125)  评论(0编辑  收藏  举报

导航