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即可
转载于:https://www.cnblogs.com/lg00001/p/9102359.html
mysql for Mac 下创建数据表中文显示为?的解决方法相关推荐
- mysql for mac中文_mysql for Mac 下创建数据表中文显示为?的解决方法
在我的绝版Mac mini下安装了mysql 5.7版本,实例中,在通过load data 导入数据时发现表中的中文显示为 ? 通过百度,发现多个版本的解决方法,将其中一个成功解决的方法贴上来: 大 ...
- sublime text html乱码,Sublime Text 2中文显示乱码的解决方法
Sublime Text 2中文显示乱码的解决方法 发布时间:2014-05-12 15:30:14 作者:佚名 我要评论 这篇文章主要介绍了Sublime Text 2中文显示乱码的解决方法 ...
- MySQL学习笔记_4_MySQL创建数据表(下)
MySQL创建数据表(下) 五.数据表类型及存储位置 1.MySQL与大多数数据库不同,MySQL有一个存储引擎概念.MySQL可以针对不同的存储需求选择不同的存储引擎. 2. showengines ...
- MySQL学习笔记_2_MySQL创建数据表(上)
MySQL创建数据表(上) 一.创建数据表的SQL语句模型[弱类型] CREATETABLE [IF NOT EXISTS] 表名称( 字段名1列的类型[属性][索引], 字段名2 列的类型[属性][ ...
- mysql查看用户名_Mysql创建数据表的方法介绍(附示例)
本篇文章给大家带来的内容是关于Mysql创建数据表的方法介绍(附示例),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. 数据表是数据库最重要的组成部分之一,是其他对象的基础.如果我们的 ...
- MySQL学习笔记_3_MySQL创建数据表(中)
MySQL创建数据表(中) 三.数据字段属性 1.unsigned[无符号] 可以让空间增加一倍 比如可以让-128-127增加到0-255 注意:只能用在数值型字段 2.zerofill[前导零] ...
- MySQL(10)--- 创建数据表
MySQL 创建数据表 创建MySQL数据表需要以下信息: 表名 表字段名 定义每个表字段 语法 以下为创建MySQL数据表的SQL通用语法: CREATE TABLE table_name (col ...
- python处理json数据 乱码报错_python操作mysql中文显示乱码的解决方法
本文实例展示了一个脚本python用来转化表配置数据xml并生成相应的解析代码. 但是在中文编码上出现了乱码,现将解决方法分享出来供大家参考. 具体方法如下: 1. Python文件设置编码 utf- ...
- mysql like 中文版_MySQL使用like查询中文不准确的解决方法
Mysql数据库like查询中文出现不准确的解决方法,中文检索有时候有点蛋疼,Mysql数据库like查询中文有时候会出现不准确.而且,在进行like检索时,有时候会返回一些与查询词不相关的记录,如查 ...
最新文章
- Ajax接收Java异常_java – 处理来自Servlet的Jquery AJAX响应中的异常
- java json转map
- AI 图像傅里叶变换
- 7.6~7.20集训总结(一)
- v8学习笔记(五) 编译过程
- install and use zookeeper C client API
- Vue-注册全局组件的两种方法
- 自己做的PPT试题或其它文件模板有时被系统还原成原来默认的样子,如何解决?
- Ubuntu环境下下载Android-SDK-Linux之后使用adb连接设备报错
- [转帖]方正数码发布基于龙芯3A3000系列整机
- 刚学的一招呵呵,愚人节到了,教个大家最强的整人方法
- 国潮席卷!这家高端酒店品牌推出以唐风宋韵为基础的“新国风”酒店
- “哥”不信“神马浮云”
- exercsie13 参数 解包 变量
- Linux下录屏软件obs安装
- epub格式电子书剖析
- springboot引入国际化
- 【Workflow】5类经典科学工作流任务数统计
- Django在view中读取txt文件
- NBA 大量球迷敏感信息被泄露
热门文章
- jggrid应用于asp.net
- 在Windows平台架设DNS服务器
- Mysql —— C语言链接mysql数据库,命令行形式(getopt()函数),用户、用户组增删改查(用户组表内有用户控制的策略字段)
- ZPhotoEngine超级算法库
- Swift 异常处理
- 3ds Max绘制青花瓷茶壶
- 9.11排序与查找(三)——给定一个排序后的数组,包括n个整数,但这个数组已被旋转过多次,找出数组中的某个元素...
- 写一个简单的爬虫 - 如何模拟登录网站
- conrtex 和 ARM 的关系
- 利用委托机制处理.NET中的异常