停用命令:sudo mysqladmin shutdown -u root -p
启用命令:sudo /etc/init.d/mysql restart
或者:sudo mysqld_safe -user=mysql &3.查看现在mysql的编码进入mysql命令:sudo mysql -u root -p
检查mysql字符集命令:show variables like 'character%';
+--------------------------+----------------------------+| 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/ | +--------------------------+----------------------------+
4.原来建的库和表似乎都无法生效,不过新建的则可以正常显示中文!
注意:
如果不能启动,错误日志为:/usr/bin/mysqld: unknown variable 'default-character-set=utf8'
通过rpm包的方式安装了MySQL-server-5.5.11,直接在命令行输入service mysql start,启动mysql成功,
然后修改/etc/my.cnf,给[mysqld]下增加了default-character-set=utf8,再重启mysql服务,这时候报错:
Starting MySQL............The server quit without updating PID file (/var/lib/mysql/node1.pid). [faild]
查看日志/var/log/mysql.log,发现其中提示:
/usr/bin/mysqld: unknown variable 'default-character-set=utf8'
看来是 default-character-set=utf8这个设置项惹得祸....
在网上搜索一番,发现有人提出,用character_set_server=utf8来取代 default-character-set=utf8 能解决这个问题,
试了试,换掉 character_set_server=utf8, 再启动果然没问题了...
新闻热点
疑难解答