MySQL command line when importing SQL file garbled solution

Source: Internet
Author: User
Tags mysql command line

Note:

Sql> Source F:weibo.sql (execute related SQL file)

Sql> SELECT * from Sina to outfile "/weibo.txt" (export the corresponding data to C: weibo.txt)

1. MySQL 5.0 after its client only support GBK, it can be in sql> set names GBK;

For example:

set names GBK;/*navicat MySQL Data transfersource server:localhost_3306source Server version:50140source Host:lo         Calhost:3306source database:sinaweibotarget Server type:mysqltarget server Version:50140file Encoding : 65001date:2013-12-16 09:16:41*/Create database ' sinadata ' DEFAULT CHARACTER SET GBK; Use ' sinadata '; SET foreign_key_checks=0;--------------------------------Table structure for ' Xinlang '---------------------------- --drop TABLE IF EXISTS ' Xinlang '; CREATE TABLE ' Xinlang ' (' id ' int (255) NOT NULL auto_increment, ' person_id ' varchar (255) DEFAULT NULL, ' article ' Varch AR (+) default NULL, ' discuss ' varchar (+) default NULL, ' transmit ' varchar (255) default NULL, ' Time ' datetime DEF Ault NULL, PRIMARY KEY (' id ')) engine=myisamDEFAULT CHARSET=GBK;--------------------------------Records of Weibo------------------------------INSERT into ' Xinlang ' VALUES (' 1 ', ' 1646051850 ', ' movie Prophecy: The film director made a number of years ago in the film in the fictional scene, language in the later became a reality, netizens call this movie content movie prophecy. This article lists three examples of movie prophecies ... Http://t.cn/S4K2hJ ', ' 0 ', ' 0 ', ' 2011-11-29 13:26:24 ');

2. Eclipse in windows->preferences->content types->text->default ENCODING:GBK settings can display the Chinese garbled

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.