MySQL命令行无法显示中文及中文显示乱码如何解决?

在使用MySQL命令行执行SQL语句时,经常会发生命令行中无法显示中文或者中文显示乱码的问题。这一般是由字符集导致的。

首先,检查表和数据库的字符集设置;一般都设置为GBK;

CREATE TABLE `student` (
  `student_id` int(11) NOT NULL DEFAULT '0',
  `student_name` varchar(100) DEFAULT NULL,
  `class_id` int(11) DEFAULT NULL,
  `gender` varchar(10) DEFAULT NULL,
  `birth_day` date DEFAULT NULL,
  PRIMARY KEY (`student_id`)
) ENGINE=MyISAM DEFAULT CHARSET=gbk;

然后,在命令行中执行命令,设置结果集的字符集:

set character_set_results=gb2312;

 

【版权说明:仅允许非商业转载且请注明出处:Mac私塾 网址:http://macsishu.com】
  1. The road seemed to stretch on endlessly before us, but Alexis assured me that our journey was near an end. We’d turn before long into thick woods and travel through narrow, winding roads until we reached her family’s cabin. I had no choice but to trust her as GPS had given out nearly 20 minutes ago.

    “There’s good wifi and okay reception at the cabin,” she’d told me, “but you can’t get there unless you know the way.”

    So here I was, driving alone in the middle of god knows where with a girl who was my student just a couple of weeks ago. Her and her four best friends had been together from first grade all the way through high school and now they had graduated with very different futures ahead of them. They had decided to kick off “the best summer ever” with a week long stay at Alexis’s family cabin. Alexis and I were heading up before everyone else, the four other girls and four guys.

altyazili进行回复 取消回复

邮箱地址不会被公开。