- 安装mysql
sudo apt-get install mysql-server mysql-client
登陆后查看数据库当前编码:SHOW VARIABLES LIKE 'character%'
- 修改默认编码为
utf-8
修改/etc/mysql/my.cnf
(默认安装路径下) (标签下没有的添加,有的修改)
[mysqld]
character_set_server=utf8
[mysql]
default-character-set= utf8
[client]
default-character-set = utf8
- 启动命令
- 停止MySQL数据库服务
sudo systemctl stop mysql.service
- 启动MySQL数据库服务:
sudo systemctl start mysql.service
- 重启MySQL数据库服务:
sudo systemctl restart mysql.service
- 查看MySQL运行状态:
sudo systemctl status mysql.service
网友评论