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;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM