如何在WAMPSERVER中更改我的MySQL排序规则 [英] How can I change my MySQL collation in WAMPSERVER
问题描述
我如何将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屋!