如何在WAMPSERVER中更改我的MySQL排序规则 [英] How can I change my MySQL collation in WAMPSERVER

查看:156
本文介绍了如何在WAMPSERVER中更改我的MySQL排序规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何将WAMPSERVER中的MySQL排序规则从latin1_swedish_ci更改为UTF-8,因为我认为我的HTML特殊字符搞砸了

How can I change my MySQL collation in WAMPSERVER from latin1_swedish_ci to UTF-8 because I think my HTML special characters are getting all messed up

推荐答案

您可以使用

set names 'utf8'

每次打开连接时.

或将以下行添加到my.ini文件中,然后重新启动服务器.

Or add the following line to your my.ini file and restart your server.

default-character-set=utf8

如果您已经设置了表格,则也需要更改它们,您可以使用以下方法进行更改:

If you've already got tables set up you'll need to alter them too you can alter them with:

ALTER TABLE tablename COLLATE utf8_general_ci

etc或弹出phpmyadmin并在那里执行.请记住,如果您更改数据库排序规则,它只会影响在此之后创建的新表,而不会影响该数据库中已经存在的表,因此您还需要更改它们.

etc or pop into phpmyadmin and do it there. Remember if you alter database collation it'll only affect new tables created after that not pre-existing ones in that database already, so you will need to alter them also.

这篇关于如何在WAMPSERVER中更改我的MySQL排序规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆