前言:
现在看官们对“ubuntu默认编码设置”都比较关注,各位老铁们都需要知道一些“ubuntu默认编码设置”的相关资讯。那么小编也在网摘上收集了一些有关“ubuntu默认编码设置””的相关资讯,希望同学们能喜欢,姐妹们快快来了解一下吧!登陆mysql 查看 默认编码
show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
1.关闭mysql服务
使用以下命令可以查看MySQL服务的状态:
service mysql status
2.
admin@xx:/etc/mysql/conf.d$ service mysql stop
admin@xx:/etc$ cd mysql
admin@xx:/etc/mysql$ ls
conf.d debian-start my.cnf.fallback mysql.conf.d
debian.cnf my.cnf mysql.cnf
admin@xx:/etc/mysql$ vim my.cnf
#发现是引用其他cnf文件:conf.d下的mysql.cnf,和mysql.conf.d下的mysqld.cnf
admin@xx:/etc/mysql$ cd mysql.conf.d/
admin@xx:/etc/mysql/mysql.conf.d$ ls
mysqld.cnf mysqld_safe_syslog.cnf
admin@xx:/etc/mysql/mysql.conf.d$ sudo vim mysqld.cnf
[sudo] admin 的密码:
在[mysqld]下追加:
character-set-server=utf8
(编辑可参考vim使用技巧)
admin@xx:/etc/mysql/mysql.conf.d$ cd ..
admin@xx:/etc/mysql$ ls
conf.d debian-start my.cnf.fallback mysql.conf.d
debian.cnf my.cnf mysql.cnf
admin@xx:/etc/mysql$ cd conf.d/
admin@xx:/etc/mysql/conf.d$ ls
mysql.cnf mysqldump.cnf
admin@xx:/etc/mysql/conf.d$ sudo vim mysql.cnf
在[mysql]下追加:
default-character-set=utf8
3.启动mysql服务
admin@xx:/etc/mysql/conf.d$ service mysql start
4.登陆mysql,查看 mysql> \s
mysql Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper
Connection id: 14
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.26-0ubuntu0.18.04.1 (Ubuntu)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 1 hour 21 min 41 sec
标签: #ubuntu默认编码设置