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;

 

posted @ 2019-04-20 22:32  醉黑泥  阅读(1524)  评论(0编辑  收藏  举报