MySQLクライアントは漢字の文字化けしの解決を表示します

15193 ワード

D:mysql5>.binmysqld-max-nt.exe --console

061106 20:35:21  InnoDB: Started; log sequence number 0 43655

061106 20:35:22 [Note] .binmysqld-max-nt.exe: ready for connections.

Version: '5.0.18-nt-max'  socket: ''  port: 3306  MySQL Community Edition (GPL)



Microsoft Windows XP [   5.1.2600]

(C)      1985-2001 Microsoft Corp.



C:Documents and SettingsAdministrator>cd d:mysql5bin



C:Documents and SettingsAdministrator>d:



D:mysql5bin>mysql -uroot

Welcome to the MySQL monitor.  Commands end with ; or g.

Your MySQL connection id is 1 to server version: 5.0.18-nt-max



Type 'help;' or 'h' for help. Type 'c' to clear the buffer.



mysql> use test

Database changed

mysql> SHOW VARIABLES LIKE 'character_set%';

+--------------------------+---------------------------+

| Variable_name            | Value                     |

+--------------------------+---------------------------+

| character_set_client     | latin1                    |

| character_set_connection | latin1                    |

| character_set_database   | latin1                    |

| character_set_results    | latin1                    |

| character_set_server     | latin1                    |

| character_set_system     | utf8                      |

| character_sets_dir       | D:mysql5sharecharsets |

+--------------------------+---------------------------+

7 rows in set (0.00 sec)



mysql> create table ad(name varchar(32));

Query OK, 0 rows affected (0.10 sec)



mysql> insert into ad values('  ');

Query OK, 1 row affected (0.00 sec)



mysql> select * from ad;

+------+

| name |

+------+

|    |

+------+

1 row in set (0.00 sec)



mysql>

  ,  、           。



                    ,               

      

my.ini

[mysqld]

default-character-set=gbk



D:mysql5>.binmysqld-max-nt.exe --defaults-file=my.ini --ansi --console

InnoDB: Error: log file .ib_logfile0 is of different size 0 5242880 bytes

InnoDB: than specified in the .cnf file 0 8388608 bytes!

061106 21:31:06 [Note] .binmysqld-max-nt.exe: ready for connections.

Version: '5.0.18-nt-max'  socket: ''  port: 3306  MySQL Community Edition (GPL)

061106 21:37:46 [Note] .binmysqld-max-nt.exe: Normal shutdown



061106 21:37:48 [Note] .binmysqld-max-nt.exe: Shutdown complete





D:mysql5>binmysqld-max-nt.exe --character_set_server=gbk  --console

InnoDB: Error: log file .ib_logfile0 is of different size 0 5242880 bytes

InnoDB: than specified in the .cnf file 0 8388608 bytes!

061106 21:39:55 [Note] binmysqld-max-nt.exe: ready for connections.

Version: '5.0.18-nt-max'  socket: ''  port: 3306  MySQL Community Edition (GPL)



  ,                       ,      



D:mysql5bin>mysql -uroot

Welcome to the MySQL monitor.  Commands end with ; or g.

Your MySQL connection id is 1 to server version: 5.0.18-nt-max



Type 'help;' or 'h' for help. Type 'c' to clear the buffer.



mysql> use test

Database changed

mysql> select * from ad;

+------+

| name |

+------+

|    |

+------+

1 row in set (0.00 sec)



mysql> SHOW VARIABLES LIKE 'character_set%';

+--------------------------+---------------------------+

| Variable_name            | Value                     |

+--------------------------+---------------------------+

| character_set_client     | latin1                    |

| character_set_connection | latin1                    |

| character_set_database   | gbk                       |

| character_set_results    | latin1                    |

| character_set_server     | gbk                       |

| character_set_system     | utf8                      |

| character_sets_dir       | D:mysql5sharecharsets |

+--------------------------+---------------------------+

7 rows in set (0.00 sec)

                ,      

mysql> create table ad2(name varchar(32));

Query OK, 0 rows affected (0.06 sec)



mysql> insert into ad2 values('  ');

Query OK, 1 row affected, 1 warning (0.01 sec)



mysql> select * from ad2;

+------+

| name |

+------+

| ??? |

+------+

1 row in set (0.01 sec)

         character_set_results  ,                 、            

mysql> set character_set_results='gbk';

Query OK, 0 rows affected (0.00 sec)



mysql> SHOW VARIABLES LIKE 'character_set%';

+--------------------------+---------------------------+

| Variable_name            | Value                     |

+--------------------------+---------------------------+

| character_set_client     | latin1                    |

| character_set_connection | latin1                    |

| character_set_database   | gbk                       |

| character_set_results    | gbk                       |

| character_set_server     | gbk                       |

| character_set_system     | utf8                      |

| character_sets_dir       | D:mysql5sharecharsets |

+--------------------------+---------------------------+

7 rows in set (0.00 sec)



mysql> select * from ad2;

+-------+

| name  |

+-------+

| ??×? |

+-------+

1 row in set (0.00 sec)



mysql> select * from ad;

+-------+

| name  |

+-------+

| ??×? |

+-------+

1 row in set (0.00 sec)

     character_set_client,      character_set_results      

mysql> set character_set_client='gbk';

Query OK, 0 rows affected (0.00 sec)



mysql> select * from ad;

+-------+

| name  |

+-------+

| ??×? |

+-------+

1 row in set (0.00 sec)



mysql> select * from ad2;

+-------+

| name  |

+-------+

| ??×? |

+-------+

1 row in set (0.00 sec)



mysql> create table ad3(name varchar(32));

Query OK, 0 rows affected (0.05 sec)



mysql> insert into ad3 values('  ');

Query OK, 1 row affected (0.00 sec)



mysql> select * from ad3;

+------+

| name |

+------+

| ??   |

+------+

1 row in set (0.01 sec)



mysql> SHOW VARIABLES LIKE 'character_set%';

+--------------------------+---------------------------+

| Variable_name            | Value                     |

+--------------------------+---------------------------+

| character_set_client     | gbk                       |

| character_set_connection | latin1                    |

| character_set_database   | gbk                       |

| character_set_results    | gbk                       |

| character_set_server     | gbk                       |

| character_set_system     | utf8                      |

| character_sets_dir       | D:mysql5sharecharsets |

+--------------------------+---------------------------+

7 rows in set (0.00 sec)

     character_set_connection,            ,     、            

mysql> set character_set_connection='gbk';

Query OK, 0 rows affected (0.00 sec)



mysql> select * from ad3;

+------+

| name |

+------+

| ??   |

+------+

1 row in set (0.00 sec)



mysql> select * from ad2;

+-------+

| name  |

+-------+

| ??×? |

+-------+

1 row in set (0.00 sec)



mysql> select * from ad;

+-------+

| name  |

+-------+

| ??×? |

+-------+

1 row in set (0.00 sec)



             

mysql> show create table ad;

+-------+----------------------------------------------------------------------------------------------+

| Table | Create Table                                                                                 |

+-------+----------------------------------------------------------------------------------------------+

| ad    | CREATE TABLE `ad` (

  `name` varchar(32) default NULL

) ENGINE=MyISAM DEFAULT CHARSET=latin1 |

+-------+----------------------------------------------------------------------------------------------+

1 row in set (0.00 sec)



mysql> show create table ad2;

+-------+--------------------------------------------------------------------------------------------+

| Table | Create Table                                                                               |

+-------+--------------------------------------------------------------------------------------------+

| ad2   | CREATE TABLE `ad2` (

  `name` varchar(32) default NULL

) ENGINE=MyISAM DEFAULT CHARSET=gbk |

+-------+--------------------------------------------------------------------------------------------+

1 row in set (0.00 sec)



mysql> show create table ad3;

+-------+--------------------------------------------------------------------------------------------+

| Table | Create Table                                                                               |

+-------+--------------------------------------------------------------------------------------------+

| ad3   | CREATE TABLE `ad3` (

  `name` varchar(32) default NULL

) ENGINE=MyISAM DEFAULT CHARSET=gbk |

+-------+--------------------------------------------------------------------------------------------+

1 row in set (0.00 sec)

      、      ,      

mysql> set character_set_client=gbk;

Query OK, 0 rows affected (0.00 sec)



mysql> set character_set_connection=gbk;

Query OK, 0 rows affected (0.00 sec)



mysql> set character_set_results=gbk;

Query OK, 0 rows affected (0.00 sec)



mysql> create table ad4(name varchar(32));

Query OK, 0 rows affected (0.06 sec)



mysql> insert into ad4 values('  ');

Query OK, 1 row affected (0.00 sec)



mysql> select * from ad;

+-------+

| name  |

+-------+

| ??×? |

+-------+

1 row in set (0.00 sec)



mysql> select * from ad4;

+------+

| name |

+------+

|    |

+------+

1 row in set (0.00 sec)



mysql> create table ad5(name varchar(32)) DEFAULT CHARSET=gbk;

Query OK, 0 rows affected (0.10 sec)



mysql> insert into ad5 values('  ');

Query OK, 1 row affected (0.00 sec)



mysql> select * from ad5;

+------+

| name |

+------+

|    |

+------+

1 row in set (0.00 sec)



mysql> select * from ad4;

+------+

| name |

+------+

|    |

+------+

1 row in set (0.00 sec)



mysql> show create table ad4;

+-------+--------------------------------------------------------------------------------------------+

| Table | Create Table                                                                               |

+-------+--------------------------------------------------------------------------------------------+

| ad4   | CREATE TABLE `ad4` (

  `name` varchar(32) default NULL

) ENGINE=MyISAM DEFAULT CHARSET=gbk |

+-------+--------------------------------------------------------------------------------------------+

1 row in set (0.00 sec)



mysql> show create table ad5;

+-------+--------------------------------------------------------------------------------------------+

| Table | Create Table                                                                               |

+-------+--------------------------------------------------------------------------------------------+

| ad5   | CREATE TABLE `ad5` (

  `name` varchar(32) default NULL

) ENGINE=MyISAM DEFAULT CHARSET=gbk |

+-------+--------------------------------------------------------------------------------------------+

1 row in set (0.00 sec)



mysql> show create table ad3;

+-------+--------------------------------------------------------------------------------------------+

| Table | Create Table                                                                               |

+-------+--------------------------------------------------------------------------------------------+

| ad3   | CREATE TABLE `ad3` (

  `name` varchar(32) default NULL

) ENGINE=MyISAM DEFAULT CHARSET=gbk |

+-------+--------------------------------------------------------------------------------------------+

1 row in set (0.00 sec)



mysql> exit

Bye