Database importation

Don't use PowerShell to execute below commands, use cmd if you want to import database with correct encoding.

-u specify user and -p specify connection with password, this one will be asked when command is executed.

In this example, prompt is in same directory of file.sql, of course it's necessary to give the relative path of SQL file with this command.

mysql -u username -p db_name < file.sql
Get-Content file.sql | mysql -u username -p db_name

With more details

mysql -u user -p

Create database

With CLI or in phpMyAdmin

CREATE DATABASE db_name;

Import database in verbose

use db_name
source file.sql

dump

To save database, it's useful to dump like this

mysqldump -u user -p --databases my_database > my_database.sql

Source: https://community.jaguar-network.com/sauvegarde-automatique-dune-db-mysql-avec-mysqldump