MySQL常用:Got a packet bigger than 'max_allowed_packet' bytes & MySQL开远程服务

1. 数据导入时出现错误

Got a packet bigger than 'max_allowed_packet' bytes

通过终端进入mysql控制台

mysql>show VARIABLES like '%max_allowed_packet%';

+--------------------------+------------+
| Variable_name            | Value      |
+--------------------------+------------+
| max_allowed_packet       | 4194304    |
| slave_max_allowed_packet | 1073741824 |
+--------------------------+------------+

mysql>set global max_allowed_packet = 1048576*100;

默认值4M大小

2. 简便方式开启MySQL远程访问服务

查看用户访问权限

mysql>use mysql;
Database changed
mysql> select host, user, password from user;

新建用户方式

mysql>grant all on *.* to newUser@'%' identified by 'newPassword' with grant option; 
mysql>flush privileges;

root用户授权方式

mysql>grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option; 
mysql>flush privileges;

 

上一篇:oracle 问题:ORA-28040:没有匹配的验证协议


下一篇:docker中的镜像中运行Django项目