how to create user and grant on diffenrent mysql version

mysql5.6:

grant all on *.* to ‘root’@'%' identified by 'chenshi.de';

mysql5.7:

create user 'root'@'%' identified by 'chenshi.de';
grant all on *.* to 'root'@'%';

mysql8.0:

create user root@'%' identified with caching_sha2_password by 'chenshi.de'; #mysql_native_password
grant all on *.* to 'root'@'%';

extra skills:

[client]
default-character-set=utf8

[mysqld]
server-id = 1
log-bin = mysql-bin
expire_logs_days = 3
innodb_flush_log_at_trx_commit = 1
sync_binlog = 1
change master to master_host = '172.16.16.16', master_user = 'copy', master_password = 'chenshi.de', master_port = '3306', master_log_file = 'mysql-bin.000002', master_log_pos=100;

references:

https://stackoverflow.com/questions/3513773/change-mysql-default-character-set-to-utf-8-in-my-cnf