mysql for Mac 下创建数据表中文显示为?的解决方法
在我的绝版Mac mini下安装了mysql 5.7版本,实例中,在通过load data 导入数据时发现表中的中文显示为 ?

通过百度,发现多个版本的解决方法,将其中一个成功解决的方法贴上来:
大多方法都是这样:需要到/usr/local/mysql/support-files目录下将Mac上的mysql配置文件模板my-default.cnf拷贝到/etc下并重命名为my.cnf
但是我的support-files目录下也不存在my.cnf文件,所以只能在终端重新创建了:
打开终端,输入:
cd /etc sudo vim my.cnf
在vim模式下,复制粘贴以下代码:
# Example MySQL config file for small systems.
#
# This is for a system with little memory (<= 64M) where MySQL is only used
# from time to time and it's important that the mysqld daemon
# doesn't use much resources.
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients
[client]
default-character-set=utf8
#password = your_password
port = 3306
socket = /tmp/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16K
max_allowed_packet = 1M
table_open_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 128K
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (using the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
server-id = 1
# Uncomment the following if you want to log updates
#log-bin=mysql-bin
# binary logging format - mixed recommended
#binlog_format=mixed
# Causes updates to non-transactional engines using statement format to be
# written directly to binary log. Before using this option make sure that
# there are no dependencies between transactional and non-transactional
# tables such as in the statement INSERT INTO t_myisam SELECT * FROM
# t_innodb; otherwise, slaves may diverge from the master.
#binlog_direct_non_transactional_updates=TRUE
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /usr/local/mysql/data
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /usr/local/mysql/data
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
[mysqlhotcopy]
interactive-timeout
关键是在[mysqld]下的这几句:
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
粘贴完成,检查首行是否漏掉了 #
检查无误按 ESC退出编辑,输入 :wq! 回车退出vim模式
重启mysql即可

mysql for Mac 下创建数据表中文显示为?的解决方法的更多相关文章
- JDBC插入数据时中文变为问号的解决方法
JDBC插入数据时中文变为问号的解决方法 制作人:全心全意 出现中文变问号的代码: String url = "jdbc:mysql://localhost:3306/test"; ...
- MySQL学习笔记_4_MySQL创建数据表(下)
MySQL创建数据表(下) 五.数据表类型及存储位置 1.MySQL与大多数数据库不同,MySQL有一个存储引擎概念.MySQL可以针对不同的存储需求选择不同的存储引擎. 2. showengines ...
- MySQL学习笔记_2_MySQL创建数据表(上)
MySQL创建数据表(上) 一.创建数据表的SQL语句模型[弱类型] CREATETABLE [IF NOT EXISTS] 表名称( 字段名1列的类型[属性][索引], 字段名2 列的类型[属性][ ...
- MySQL学习笔记_3_MySQL创建数据表(中)
MySQL创建数据表(中) 三.数据字段属性 1.unsigned[无符号] 可以让空间增加一倍 比如可以让-128-127增加到0-255 注意:只能用在数值型字段 2.zerofill[前导零] ...
- [ArcGIS]Oracle RAC下创建地理数据库(Create Enterprise Geodatabase)失败的解决方法
转载请注明原文地址:http://www.cnblogs.com/litou/p/8028843.html 环境:Oracle 11g 11.2.0.1.0(双节点RAC群集),ArcGIS Desk ...
- Mac下安装SVN插件javaHL not available的解决方法
在Mac下安装Eclipse插件svnEclipse插件后,每次打开Eclipse都会弹出如下弹出框: 提示你本机缺少JavaHL Library. 选择Eclipse→偏好设置(preference ...
- SecureCRT中文显示乱码的解决方法
注:本文出自:http://riching.iteye.com/blog/349754 最近开始用SecureCRT登陆linux系统,由于是新手,很多问题不清楚,碰到显示中文乱码的问题,困扰了好几天 ...
- Saiku图表导出时中文显示问题的解决方法
Saiku图表导出时png,jpg,pdf三种格式的中文显示都有问题,目前找到一种不太完善的解决方法(中文可以显示但不清晰),需要修改Saiku项目下的ExporterResource.java文件, ...
- PLSQL Developer 中文显示乱码的解决方法
PLSQL Developer 中文显示乱码是因为 Oracle 数据库所用的编码和 PLSQL Developer 所用的编码不同所导致的. 解决方法: 1. 先查询 Oracle 所用的编码 se ...
随机推荐
- Vue对象的生命周期
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Python自学第一天
Python #-*- coding:utf8 -*-(Python文件开头添加)用来解决中文编码问题 注:Python3以上文件不用加 一.变量:变量有数字.字母和下划线组成 1.不能以数字开头 2 ...
- 使用Anaconda3安装tensorflow,opencv,使其可以在spyder中运行
使用Anaconda5.0.0 1.首选无论你是在cmd键入python,还是在Anaconda Prompt键入python,显示的都是Python3.6.然而在Spyder(tensorflow) ...
- mintUI修改toast样式的问题解决办法
在公共样式中加入 /*修改mintUI 弹窗样式大小*/ .noticeErrorToast{ transform: scale(2) !important; margin-left:-.6rem ! ...
- window下 nginx 80端口被占用
问题:启动nginx没有反应,查看日志提示 bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in ...
- NHibernet 事务 修改操作,事务没提交,数据库数据却同步(修改)了
Nhibernet 缓存 由于查询出来的数据和缓存关联,更新之后就算事务没执行提交操作,数据库依旧会更新,解决方法, 清空缓存,实例不和缓存关联,如下面标红代码 public bool UpdateT ...
- lodash throttle和debounce
https://lodash.com/docs#debounce throttle(又称节流)和debounce(又称防抖)其实都是函数调用频率的控制器 throttle:将一个函数的调用频率限制在一 ...
- 变量管理 dotenv 的 使用
python-dotenv 安装 pip install python-dotenv 或 pipenv install python-dotenv --skip-lock 创建目标文件 在项目根目录下 ...
- BZOJ2839 集合计数 二项式反演
题目传送门 https://lydsy.com/JudgeOnline/problem.php?id=2839 题解 二项式反演板子题. 类似于一般的容斥,我们发现恰好 \(k\) 个不怎么好求,但是 ...
- MySQL查看表索引
mysql> show index from tblname; mysql> show keys from tblname; · Table 表的名称. · Non_unique 如果索引 ...