1.安裝mysql:
sudo apt-get install mysql-server mysql-client
登陸后查看數據庫當前編碼:SHOW VARIABLES LIKE 'character%';
2.修改默認編碼為utf-8
修改/etc/mysql/my.cnf (默認安裝路徑下) (標簽下沒有的添加,有的修改)
[mysqld]
character_set_server=utf8
[mysql]
default-character-set= utf8
[client]
default-character-set = utf8
3.查詢的一些命令
停止MySQL數據庫服務:
$ sudo systemctl stop mysql.service
啟動MySQL數據庫服務:
$ sudo systemctl start mysql.service
重啟MySQL數據庫服務:
$ sudo systemctl restart mysql.service
查看MySQL運行狀態:
$ sudo systemctl status mysql.service