安装mysql

为了简单,直接安装库里面的就好了

apt-get install mysql-server

修改my.cnf

[client]
default-character-set=utf8mb4

[mysqld]
character_set_server=utf8mb4
init_connect='SET NAMES utf8mb4' 

查看是否生效

SHOW VARIABLES LIKE 'character%';

修改Mysql远程权限
在my.cnf修改bind的地址

update user set host = '%' where user = 'root' and host = '';

刷新权限

flush privileges;

修改密码

UPDATE mysql.user SET password=PASSWORD('new_password') WHERE user='user_name';