Home > Database > Mysql Tutorial > ubuntu修改my.cnf文件导致mysql启动不了的问题_MySQL

ubuntu修改my.cnf文件导致mysql启动不了的问题_MySQL

WBOY
Release: 2016-06-01 13:40:44
Original
1127 people have browsed it

Ubuntu

bitsCN.com
ubuntu修改my.cnf文件导致mysql启动不了的问题 最近在虚拟机上配置mysql,由于安装后字符集显示为 查询一下show variables like 'character%'; +--------------------------+----------------------------+ | 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/share/mysql/charsets/ | +--------------------------+----------------------------+ 
 先需要全部修改为utf8,根据网上提示修改mysql的启动配置文件 my.cnf 网上基本步骤为: 找到[client] 添加: default-character-set=utf8 //默认字符集为utf8    找到[mysqld] 添加: //默认字符集为utf8 default-character-set=utf8 //设定连接mysql数据库时使用utf8编码,以让mysql数据库为utf8运行 
 init_connect='SET NAMES utf8' 可是我根据这样修改后启动mysql服务报错,启动不了 在网上试了多种解决办法,都没有解决, 最后找到一个方法,可以解决,如下: 其他的还跟上面一样,只有在[mysqld]下面添加的 default-character-set=utf8 改为 character-set-server = utf8 重新启动mysql,启动成功 再查看编码为:  
 +--------------------------+----------------------------+ | 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/share/mysql/charsets/ | +--------------------------+----------------------------+  bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template