Fix MySQL/MariaDB error "Got a packet bigger than 'max_allowed_packet' bytes"

For the client:

mysql --max_allowed_packet=100M -u root -p db < dump.sql
For permanent fix - change the my.cnf
[mysqld]
max_allowed_packet=100M
and restart the server

To fix it without restarting the server, connect to server and execute:
set global net_buffer_length=1000000; 
set global max_allowed_packet=1000000000;
Get the current status:
SHOW VARIABLES LIKE 'max_allowed_packet';