mysql维护笔记

允许远程访问

  1. 被访问绑定地址的的修改 修改 my.cnf 文件
1
2
[mysqld]
bind-address = 0.0.0.0
  1. 保存并重启mysql服务
1
$ sudo /etc/init.d/mysql restart
  1. 授权用户远程链接
1
2
3
mysql> grant all privileges on *.* to root@"%" identified by "password" with grant
option;
mysql> flush privileges;

支持表情

  1. my.cnf 添加以下内容
1
2
3
4
5
[mysqld] character-set-server = utf8mb4 collation-server = utf8mb4_general_ci init_connect='SET NAMES utf8mb4' skip-character-set-client-handshake = true

[client] default-character-set=utf8mb4

[mysql] default-character-set=utf8mb4
  1. 重启服务
1
$ sudo /etc/init.d/mysql restart
  1. 修改对应的数据库,表,字段