精华内容
下载资源
问答
  • Mac修改mysql字符集

    千次阅读 2016-02-25 22:41:44
    mysql 里插入中文时显示乱码,那是因为 mysql 字符集不对造成的,下面做下笔记,mac修改mysql的默认字符集为utf8: 1. 检查默认安装的mysql字符集,登陆 mysqlmysql> show variables like '%char...

    向 mysql 里插入中文时显示乱码,那是因为 mysql 字符集不对造成的,下面做下笔记,mac下修改mysql的默认字符集为utf8:

    1. 检查默认安装的mysql的字符集,登陆 mysql 后

    mysql> show variables like '%char%'; 或 show variables like 'character_set_%';

    +--------------------------+--------------------------------------------------------+
    | Variable_name            | Value                                                  |
    +--------------------------+--------------------------------------------------------+
    | character_set_client     | utf8                                                   |
    | character_set_connection | utf8                                                   |
    | character_set_database   | latin1                                                 |
    | character_set_filesystem | binary                                                 |
    | character_set_results    | utf8                                                   |
    | character_set_server     | latin1                                                 |
    | character_set_system     | utf8                                                   |
    | character_sets_dir       | /usr/local/mysql-5.5.23-osx10.6-x86_64/share/charsets/ |
    +--------------------------+--------------------------------------------------------+
    8 rows in set (0.00 sec)

    character_set_database和character_set_server依然是latin1的字符集,也就是说mysql后续创建的表都是latin1字符集的,不是utf8,这就是原因。所以有必要修改my.cnf,在修改my.cnf之前一定要关闭mysql进程,不然会遇到mysql的sock不能连接的问题。


    2. 关闭mysqld后台进程

    系统偏好设置里面打开mysql, 点击 Stop MySQL Server。
    3. 修改mysql配置文件/etc/my.cnf
    在Mac OS X 中默认是没有my.cnf 文件,如果需要对MySql 进行定制,拷贝/usr/local/mysql/support-files/目录中任意一个.cnf 文件粘贴到/etc目录下,并且重命名为my.cnf ,然后修改 my.cnf 即可进行定制了。
    sudo cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
     
    sudo vi /etc/my.cnf
     
    [client]部分加入:
    default-character-set=utf8
    [mysqld]部分加入:
    character-set-server=utf8
    修改后保存退出, 修改完毕之后再启动mysql。
    4. 检查结果:
    重新启动mysql:
    mysql> show variables like '%char%';
    +--------------------------+--------------------------------------------------------+
    | 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/local/mysql-5.5.23-osx10.6-x86_64/share/charsets/ |
    +--------------------------+--------------------------------------------------------+
    8 rows in set (0.00 sec)
    修改完毕#




    展开全文
  • mac修改mysql的默认字符集为utf8

    千次阅读 2015-10-09 18:26:51
    mac修改mysql的默认字符集为utf8

    http://blog.csdn.net/waleking/article/details/7620983

    1,检查默认安装的mysql的字符集

    mysql> show variables like '%char%';
    +--------------------------+--------------------------------------------------------+
    | Variable_name            | Value                                                  |
    +--------------------------+--------------------------------------------------------+
    | character_set_client     | utf8                                                   |
    | character_set_connection | utf8                                                   |
    | character_set_database   | latin1                                                 |
    | character_set_filesystem | binary                                                 |
    | character_set_results    | utf8                                                   |
    | character_set_server     | latin1                                                 |
    | character_set_system     | utf8                                                   |
    | character_sets_dir       | /usr/local/mysql-5.5.23-osx10.6-x86_64/share/charsets/ |
    +--------------------------+--------------------------------------------------------+
    8 rows in set (0.00 sec)

    character_set_database和character_set_server依然是latin1的字符集,也就是说mysql后续创建的表都是latin1字符集的,不是utf8,会造成一些麻烦。所以有必要修改my.cnf,在修改my.cnf之前一定要关闭mysql进程,不然会遇到mysql的sock不能连接的问题。

    2,关闭mysqld后台进程

    系统偏好设置里面控制mysqld,避免了去找mysqld安装位置的麻烦。


    点击 Stop MySQL Server




    3,修改mysql配置文件/etc/my.cnf

    sudo cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf

    sudo vi /etc/my.cnf

    [client]部分加入:

    default-character-set=utf8

    [mysqld]部分加入:

    character-set-server=utf8

     修改完毕之后再启动mysql

    4,检查结果:

    mysql> show variables like '%char%';
    +--------------------------+--------------------------------------------------------+
    | 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/local/mysql-5.5.23-osx10.6-x86_64/share/charsets/ |
    +--------------------------+--------------------------------------------------------+
    8 rows in set (0.00 sec)

    修改完毕#

    感谢营长提供上述解决方案!

    展开全文
  • 本文主要介绍了如何修改MAC版mysql默认字符集为utf8,如果你的MACmysql字符乱码,可以参考一下
  • 一、首先要知道怎么查看Mac下诸如/usr、/etc等等的文件夹 正常打开Finder的话显示界面是这样:(是看不到这些个文件夹在哪里的) 那么我们要怎么做呢? 各位可以打开Finder后按快捷键:command...
    • 这个问题烦恼一天了,现在终于得以解决。分享给大家
    • 首先贴出来,亲测不可行的博客连接:
      • http://www.2cto.com/database/201305/215563.html
      • http://blog.csdn.net/waleking/article/details/7620983
      • http://m.blog.csdn.net/blog/u012807459/38614089
      • 也可能是我执行的方法不对,也不是有意诋毁各位博主
    • 一、首先要知道怎么查看Mac下诸如/usr、/etc等等的文件夹

    正常打开Finder的话显示界面是这样:(是看不到这些个文件夹在哪里的)

    那么我们要怎么做呢?

    各位可以打开Finder后按快捷键:command + shift + G 后如下图:

    在输入框中输入:/usr 或 /etc 就可以查看了

    具体的各位请看这里: http://www.cnblogs.com/elfsundae/archive/2010/11/30/1892544.html 感谢这位博主

    • 二、现在开始修改

    首先打开『终端』 —> 输入 mysql -u root -p ->密码->回车—>连接到数据库

    然后输入 show variables like '%char%';

    显示下图:

    如果您和我的不同,那请您往下看。

    用上面打开/usr文件夹的方法,打开:

    百度翻译了一下,这个文件在说这是一个例子,解释格式要如何写。

    然后我们可以试着编辑它,发现:

    点击复制,之后全选这个文档内容,复制以下代码,覆盖文档原有内容:

    # 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 
    View Code

    文件名改为 my.cnf

    之后复制这个文件,打开Finder 用之前的方法打开/etc ,将 my.cnf 粘贴至此处

    最后 打开『偏好设置』 重启MySQL:

    现在 打开你的『终端』:

    如果你也是这样,恭喜修改成功。

    最后感谢:zhyl2010

    参考链接: http://www.dedecms.com/knowledge/data-base/mysql/2012/0819/7421.html

    展开全文
  • 测试环境:MacOS High Sierra 10.13.5  MySQL for Mac v5.7.22 &...1、MacMySQL在5.7.18之前/usr/local/mysql/support-files里有my-default.cnf,可将此文件cp至/etc 并改名成my.cnf  ...

    测试环境:MacOS High Sierra 10.13.5

                            MySQL for Mac  v5.7.22       < 8月2日>

    1、Mac版MySQL在5.7.18之前/usr/local/mysql/support-files里有my-default.cnf,可将此文件cp至/etc 并改名成my.cnf

                   /etc/my.cnf

    2、Mac版MySQL在5.7.18之后在my-default.cnf就取消了,于是找不到my-default.cnf也找不到my.cnf。

                   于是,我们只能在/etc下新建my.cnf

                               第一步:关闭数据库


                         第二步: 终端输出 $ cd /etc

                                                   $ sudo vim my.cnf

                         第三部:将以下内容复制到终端文件my.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]
        default-character-set=utf8
        #password   = your_password
        port        = 3306
        socket      = /tmp/mysql.sock
        # Here follows entries for some specific programs
        # The MySQL server
        [mysqld]
        character-set-server=utf8
        init_connect='SET NAMES utf8
        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
    

                         第四部:重启mysql。

                                         show variables like 'character_set_%';    查看MySQL的字符集就是utf_8了。

    展开全文
  • 关于如何解决Mysql安装后修改默认字符集为UTF-8 1.先登录mysql查看初始编码 show variables like 'char%'; 2.若初始数据库(character_set_datebase)默认不为UTF-8,将默认编码修改为UTF-8 一.找到my.ini文件 在这...
  • 查看Mysql字符集语句show variables like '%char%'; 在/etc 下面新建my.cnf文件,内容如下,并重启Mysql即可。# Example MySQL config file for small systems. # # This is for a system with little memory () ...
  • 在MacOS(Linux)上安装Mysql并且设置默认字符集 网上有很多教程,要不太老了,要不根本就是错误百出,我自己也在各种平台上装了好几次mysql了,今天我为大家来排坑,并详细说明到底怎么弄,是面向小白的 0.首先写...
  • 1、首先检查默认安装的字符集 mysql> show variables like '%char%'; +--------------------------+--------------------------------------------------------+ | Variable_name | ...
  • 由于最近需要用到MySQL,发现里面的字符集不是UTF-8很是郁闷。多方查找才设置过来,也记录下备用。 安装的XAMPP版本是5.6.3,启动MySQL的工具是下面酱紫的: 1、选中MySQL,然后点击“Configure”打开配置文件...
  • Mac修改mysql数据库默认字符编码

    千次阅读 2017-04-06 18:12:27
    mysql默认的编码是latin1,它不支持中文,所以我们一般需要修改他的默认编码格式。 打开终端 1. 进入root权限 sudo -i  2. cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf 3. vi /etc/my.cnf ...
  • 一、官网下载MySQL5.7 官网地址:https://downloads.mysql.com/archives/community/ 如果下载速度慢的话,建议复制到迅雷、比特彗星等多线程下载工具进行下载。 二、安装MySQL镜像 找到下载的dmg镜像,双击装载。 ...
  • 一、mysql字符集和校对 字符集是指一种从二进制编码到某类字符符号的映射。校对是指一组用于某个字符集的排序规则。在Mysql4.1和之后的版本中,每一类编码字符都有其对应的字符集和校对规则。 1. Mysql如何使用字符...
  • mysql for mac 永久修改默认字符集(解决乱码问题) 找到将my.cnf文件拷贝到/etc目录下
  • 对计算机常用字符集行说明,并且详细说明了MySQL中如何查看,设置字符集
  • 今天是2018/7/30,我的MySQL版本为5.7.23,网上看了很多把mysql默认字符集修改为utf-8的教程,我觉得都不够精简,因此总结了三个步骤: 创建my.cnf; 复制到 /etc 目录下; 重启mysql。 显示该数据库连接使用的...
  • 网上的很多都说mysql需要加client之类,你会发现根本找不到了好吗? 修改utf-8教程如下: ...4、具体实体可以进入网站,同时它提示了,请不要直接更改本文件,进入网站之后了解到需要修改一个my.c
  • mysql字符集查看与设置

    千次阅读 2019-07-17 17:01:38
    一、查看 MySQL 数据库服务器和数据库字符集 mysql> show variables like '%char%'; +--------------------------+-------------------------------------+------ | Variable_name | Value ...
  • 1.前提:已经安装了mysql服务端 2.打开电脑的“系统偏好设置” 如图 3.最下面的又MYSQL的图标 点击它 如图: 4.点击stop mysql server 停掉mysql服务;或者在你的终端中输入 sudo /Library/StartupItems/MySQLCOM...
  • MySQL 8.0.11 字符集

    千次阅读 2018-04-24 11:43:53
    字符集:是一套符号和编码校对规则:是在字符集内用于比较字符的一套规则字符集生效规则:Table继承于Database,Database继承于Server,就是说,可只设置character_set_server校对规则生效规则:如果没有设置校对...
  • 字符集:可见字符在保存和传输的时候对应的二进制代码集合。 字符集在两个地方用到 1.保存数据 2.数据传输 1.2在存续时使用字符集 1、MySQL可以在服务器上、数据库、表、字段上指定字符编码 2、在服务器上...
  • Mysql 修改字符集(Zabbix)

    千次阅读 2019-03-26 15:54:34
    1.查询Mysql数据库系统字符集 show variables like '%character%'; MariaDB [information_schema]> show variables like '%character%'; +--------------------------+----------------------------+ | ...
  • 1.查看MYSQL数据库服务器和数据库字符集 方法一:show variables like ‘%character%’; 方法二:show variables like ‘collation%’; 复制代码 mysql> show variables like ‘%character%’; ±---------------...
  • 但是用navicat建库后想修改字符集。但是没有用,不管设置成什么字符集。关了重新打开还是没变。大神帮帮忙。如图![图片说明](http://img.ask.csdbu guon.net/upload/201606/29/1467165111_120430.png)
  • MySQL或者MariaDB官方镜像缺省下的字符集为latin1,这篇文章整理一下镜像方式查看与设定缺省字符集的方法。
  • 1、先停掉mysql的服务 2、直接在/etc目录下新建my.cnf 添加如下内容 [client] default-character-set=utf8 [mysqld] collation-server = utf8_unicode_ci init-connect=‘SET NAMES utf8’ character-set-server = ...
  • MySQL字符集小结

    2020-07-21 10:41:25
    常用MySQL的排序规则介绍三.MySQL字符集相关参数3.1 字符集参数介绍3.2字符集参数修改四.数据库、表、列的字符集五.字符集和排序规则如何影响查询 前言: 1.字符集和排序规则 说实话我对这两个概念比较模糊,其实可以...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 10,034
精华内容 4,013
关键字:

mac修改mysql字符集

mysql 订阅