centos 7.2中xampp mysql 数据字符集设置解决中文乱码
2017-10-16 12:43
537 查看
centos 7.2中xampp mysql 数据字符集设置解决中文乱码
从终端进入mysql
centos系统中mysql默认字符集配置
使用xampp集成环境搭建lamp,MySQL中的my.cnf目录为
我的数据库为MariaDB 10.1.21
使用vim修改配置
网上的修改方法,适用于MySQL5.7之前,修改之后会导致MySQL 无法启动
我的修改方法为
重新启动MySQL
登陆MySQL并查看字符集
成功 latinl 改为了 UTF-8
从终端进入mysql
[root@VM_172_94_centos etc]# /opt/lampp/bin/mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.1.21-MariaDB Source distribution Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show variables like 'char_%';
centos系统中mysql默认字符集配置
+--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | latin1 | | character_set_connection | latin1 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | latin1 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /opt/lampp/share/charsets/ | +--------------------------+----------------------------+
使用xampp集成环境搭建lamp,MySQL中的my.cnf目录为
/opt/lampp/etc
我的数据库为MariaDB 10.1.21
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.1.21-MariaDB Source distribution
使用vim修改配置
[root@VM_172_94_centos etc]# vim /opt/lampp/etc/my.cnf
网上的修改方法,适用于MySQL5.7之前,修改之后会导致MySQL 无法启动
我的修改方法为
[client] default-character-set=utf8 [mysqld] collation-server=utf8_unicode_ci init-connect='SET NAMES utf8' character-set-server=utf8 [mysql] default-character-set=utf8
重新启动MySQL
[root@VM_172_94_centos etc]# /opt/lampp/lampp restart Restarting XAMPP for Linux 5.6.30-1... XAMPP: Stopping Apache...ok. XAMPP: Stopping MySQL...ok. XAMPP: Stopping ProFTPD...ok. XAMPP: Starting Apache...ok. XAMPP: Starting MySQL...ok. XAMPP: Starting ProFTPD...ok.
登陆MySQL并查看字符集
[root@VM_172_94_centos etc]# /opt/lampp/bin/mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.1.21-MariaDB Source distribution Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> 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 | /opt/lampp/share/charsets/ |
+--------------------------+----------------------------+
成功 latinl 改为了 UTF-8
相关文章推荐
- jforum用到MySQL设置字符集为UTF8(Windows版)解决中文乱码
- mysql_query设置字符集为utf8,解决中文乱码的问题
- CentOS 7下MySQL5.6的修改字符集编码为UTF8(解决中文乱码问题)
- CentOS6.5解决中文乱码与设置字符集
- CentOS6.5解决中文乱码与设置字符集
- CentOS6.5解决中文乱码与设置字符集
- xampp下mysql设置密码以及解决中文乱码问题
- HTML页面设置的字符集会影响发送到MySQL的字符集,所以当数据库字符集为utf8时,HTML页面也要设置字符集为utf8,中文乱码的一种解决办法
- mysql导入导出数据中文乱码解决方法小结(1、navicat导入问题已解决,创建连接后修改连接属性,选择高级->将使用Mysql字符集复选框去掉,下拉框选择GBK->导入sql文件OK;2、phpmyadmin显示乱码的问题也解决,两步:1.将sql文件以utf8的字符集编码另存,2.将文件中sql语句中的字段字符集编码改成utf8,导入OK)
- centos修改mysql字符集 解决中文乱码问题
- CentOS6.5解决中文乱码与设置字符集
- CentOS6.5解决中文乱码与设置字符集
- Linux下MySQL 5.5/5.6的修改字符集编码为UTF8(彻底解决中文乱码问题)适用于centos 7
- 再谈乱码问题,如何解决MYSQL数据中文乱码问题
- 如何解决MYSQL数据中文乱码问题
- 再谈乱码问题,如何解决MYSQL数据中文乱码问题
- mysql数据导入中文乱码的解决办法
- 解决Java Web开发中Jsp存储读取MySQL数据中文乱码的问题
- MySQL字符集 GBK、GB2312、UTF8区别 解决 MYSQL中文乱码问题
- mysql设置utf8_unicode_ci字符集php页面输出??乱码的解决方法