Home  >  Article  >  Database  >  MySQL4.1乱码问题_MySQL

MySQL4.1乱码问题_MySQL

WBOY
WBOYOriginal
2016-06-01 14:06:21765browse

在MySQL4.1的安装过程中有缺省character的设置在下图中有显示

如果您所在的服务器有没有选择缺省为GB则会使用UFT8就会出现乱码

或者

只要在你连到数据库后,先执行这句
mysql_query("Set Names 'uft8'");
其中 uft8 可改成你需要的编码,e.g. gb2312 等
这个命令也可以用于 mysql 得命令行,从而可以显示正确的文字

连接数据库出现
-------------------------------------------------------------------------------------------
Client does not support authentication protocol requested
by server; consider upgrading MySQL client
-------------------------------------------------------------------------------------------
由于MySQL 4.1版本开始密码的hash算法改变,所以连接数据库
时可能会出现Client does not support authentication protocol问题。

可以通过一下两种方法解决
其一:
mysql> SET PASSWORD FOR
-> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');

其二:
mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
-> WHERE Host = 'some_host' AND User = 'some_user';
mysql> FLUSH PRIVILEGES;

Statement:
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