重新配置MYSQL的字符集为UTF8。难道这个字符集不识别中文?
mysql> create database china;
Query OK, 1 row affected (0.00 sec)mysql> drop database china;
Query OK, 0 rows affected (0.06 sec)mysql> create database 中国;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '中国'
at line 1
mysql> create database '中国';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near ''中国
'' at line 1
mysql> create database china;
Query OK, 1 row affected (0.00 sec)mysql> drop database china;
Query OK, 0 rows affected (0.06 sec)mysql> create database 中国;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '中国'
at line 1
mysql> create database '中国';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near ''中国
'' at line 1
解决方案 »
- 请教一个联级操作
- 如何把下面SQL2000存储过程改为Mysql支持的存储过程?
- mysql与c++的一些问题请教
- 请指点该对哪个表做索引呢
- 一个数据库SQL查询的问题
- 5個MYSQL數據庫之間同步問題
- mysql连接不上,请各位老大指点一下!
- 我安装mysql-4.0.20在linux上,用windows下用mysql control center连接察看服务器信息,为什么显示的版本号是3.23.54,还有..
- 请问,我想对一个字段里的不同值进行计数,怎么写?
- Mysql 的REPLACE INTO用法问题
- 怎样将一个表的integer类型字段改成serial类型?
- MySQL创建存储过程的权限问题
+--------------------------+-------------------------------------+
| Variable_name | Value |
+--------------------------+-------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | D:\MySQL Server 5.1\share\charsets\ |
+--------------------------+-------------------------------------+
8 rows in set (0.00 sec)mysql> create database `中国`
-> ;
Query OK, 1 row affected (0.20 sec)mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| 中国 |
mysql> show variables like 'char%';
+--------------------------+-------------------------------------+
| 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 | D:\MySQL Server 5.1\share\charsets\ |
+--------------------------+-------------------------------------+
8 rows in set (0.00 sec)mysql> create database `中国`;
ERROR 1300 (HY000): Invalid utf8 character string: '中国'
mysql> set names gbk;
Query OK, 0 rows affected (0.00 sec)mysql> show variables like 'char%';
+--------------------------+-------------------------------------+
| Variable_name | Value |
+--------------------------+-------------------------------------+
| character_set_client | gbk |
| character_set_connection | gbk |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | gbk |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | D:\MySQL Server 5.1\share\charsets\ |
+--------------------------+-------------------------------------+
8 rows in set (0.00 sec)mysql> create database `中国`;
Query OK, 1 row affected (0.00 sec)
http://blog.csdn.net/ACMAIN_CHM/archive/2009/05/12/4174186.aspx
MySQL 中文显示乱码
你换到ubuntu下就能用utf8了。