Home > Database > Mysql Tutorial > 初始化mysql数据库时提示字符编码错误的解决办法

初始化mysql数据库时提示字符编码错误的解决办法

WBOY
Release: 2016-05-31 08:47:58
Original
891 people have browsed it

有时候在安装完数据库并初始化的时候会出现如下错误:

root@localhost mysql-5.5.19]# bash scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/home/webserver/mysqldata/

Installing MySQL system tables...

120330 16:19:42 [ERROR] Unknown collation: 'utf8-general_ci'

120330 16:19:42 [ERROR] Aborting

120330 16:19:42 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

Installation of system tables failed!  Examine the logs in

/home/webserver/mysqldata/ for more information

造成这种错误原因是在配置参数时utf8-general_ci写错了,应该是utf8_general_ci,

如果不想重新安装数据库那就在my.cnf文件中[mysqld]下面增加一行:

character_set_server=utf8

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