【MySQL】mac环境下使用navicat premium连接mysql乱码问题

---恢复内容开始---

最重要的两点:使用navicat premium创建mysql连接和在mysql连接里面创建数据库时,需要注意。

1.创建连接时,Encoding不需要手动选择,保持Auto就可以了。

2.使用该连接创建新的数据库时,也保持默认编码。

这两点注意了,如果还出现乱码的话,就有可能是mysql本身编码引起的,可以通过以下操作进行设置。

1.

在mac环境下,安装了mysql之后,/etc路径下是没有my.cnf文件的,需要我们手动添加。

找到mysql安装目录,在底下找到support-files文件夹,复制里面的my-default.cnf,到桌面,并修改其名称为my.cnf。(注:在mysql-5.7.17之后的版本好像没有了my-default.cnf)

并将里面的内容修改为以下内容:


# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# 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]
#password = your_password
port = 3306
socket = /tmp/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
character-set-server=utf8
init_connect=‘SET NAMES utf8‘

# 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
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking

# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin

# binary logging format - mixed recommended
binlog_format=mixed

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master‘s port number (3306 by default).
#
# Example:
#
# CHANGE MASTER TO MASTER_HOST=‘125.564.12.1‘, MASTER_PORT=3306,
# MASTER_USER=‘joe‘, MASTER_PASSWORD=‘secret‘;
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# change in this file to the variables‘ values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave - required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port = <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin

# 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
default-character-set=utf8

[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout


然后将其复制到/etc下面,重启mysql服务就可以了。

时间: 2024-12-28 17:57:34

【MySQL】mac环境下使用navicat premium连接mysql乱码问题的相关文章

Navicat Premium 连接MySQL数据库出现Authentication plugin &#39;caching_sha2_password&#39; cannot be loaded的解决方案

1.运行cmd,目录定位到MySql的安装目录“C:\Program Files\MySQL\MySQL Server 8.0\bin” 2.运行mysql 3.运行如下的两个命令 ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'

XMPP环境搭建 (mac环境下 安装自己独立的mysql与服务器(openfire),实现即时聊天功能)

1简单概览 [一]XMPP简介 http://xmpp.org 即时通讯技术 IM - Instant Messaging ?支持?用户在线实时交谈.交谈双?方都需要?一个聊天窗?口,其中?一个?用户输?入信息,交谈双 ?方都可以看到交谈内容 常?见IM系统 AOL.Yahoo IM.MSN.QQ 它们之间的区别在于各?自的通讯协议的实现,即时通讯技术的核?心在于它的传输协议 [二]XMPP通讯协议 协议?用来说明信息在??网络上如何传输,如果有了统?一的传输协议,各个IM之间都可以直接通讯,

使用Navicat Premium连接mysql数据库

Navicat Premium是一个可多重连接的数据库管理工 具,它可让你以单一程序同时连接. Navicat Premium 使你能简单并快速地在各种数据库系统间传输数据,或传输一份指定 SQL 格式及编码的纯文本文件.这可以简化从一台服务器迁移数据到另一台服务器的类型的进程.不同数据库的批处理作业也可以计划并在指定的时 间运行. 由于原生的mysql数据库查看表对应的触发器非常困难,且不直观,所以在网上看到了这个专门用来连接数据库的工具. 一.新建mysql连接 二.连接方式如下 三.可能出

Navicat Premium连接mysql的使用技巧

数据库工具--Navicat Premium使用技巧 2016年11月29日 10:37:25 阅读数:8739 Navicat Premium 常用功能讲解 Navicat Premium 常用功能讲解 1.快捷键 1.1. F8 快速回到当前对象列表 1.2. Ctrl + q 打开查询界面 1.3. Ctrl + d 快速修改当前的表结构 1.4. Ctrl + r 运行当前查询界面里面的 sql 语句 1.5. Ctrl + shift + r 运行当前选中的 sql 语句 2.快速查看

Ubuntu搭建mysql,Navicat Premium连接

保存编辑结果与退出vim编辑器 https://jingyan.baidu.com/article/495ba8410ff14d38b30ede01.html 首先,我们需要使用apt安装mysql,命令如下: sudo apt install mysql-server 安装MySQL时,需为默认的"root"用户指定密码(无要太复杂哦~ O(∩_∩)O) 说明:安装完mysql-server后,mysql-client就带了,无需单独安装. 成功安装后,界面如下所示: 其次,安装成功

Navicat Premium 连接 Oracle 数据库

Navicat Premium是一个可多重连接的数据库管理工具,它可让你以单一程序同時连接到 MySQL.SQLite.Oracle 及 PostgreSQL 数据库,让管理不同类型的数据库更加方便.最重要的是它不用装Oracle客户端.下边简单介绍一下Navicat Premium连接oracle客户端的方法. 如果你的机器已经装有 Oracle 数据库的话,那很简单,Navicat Premium可以直接连接到 Oracle . 如果没装,那 Navicat 会提示你需要安装 Oracle

Windows下用C语言连接Mysql注意问题

原文:Windows下用C语言连接Mysql注意问题 环境是:在VS6.0 安装Mysql后,我们需要相应的头文件以及lib文件,所以安装过程必须是完整安装.否则不会生成include文件夹哦~ 具体步骤如下: 1.完全安装mysql,这样才能生成include文件夹. 2.在Directories的标 签页中右边的"Show directories for" 下拉列表中选中"Includefiles", 然后在中间列表框中添加你本地安装MySQL的include目

Navicat Premium 连接Oracle 数据库之配置

Navicat Premium连接Oracle 数据库之配置 1.Oracle数据库服务器下载 Oracle官方网站下载数据库最新版本:http://www.oracle.com/technetwork/cn/database/enterprise-edition/downloads/index.html 2.Navicat Premium_11.2.7简体中文完美破解版(32位和64位)下载 http://download.csdn.net/detail/ahgaoyong/9482314 3

MySql集群讲解(二)Mysql Liunx环境下搭建

MySql集群讲解(二) MySQL Linux环境下搭建 A:下载: wget https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz B:安装前环境检查: 1.检查Linux是否安装了mariadb数据库,mariadb数据库是mysql的分支,执行命令: yum list installed | grep mariadb rpm -qa | grep mariadb 2.若Lin