Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6943275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:08:02+00:00 2026-05-27T13:08:02+00:00

I have a database in which the stored data are encoded in GBK. Now

  • 0

I have a database in which the stored data are encoded in GBK. Now I want to make a full dump of it and make the dump file in utf8. This way I can convert the whole database from GBK to utf8. The mysqldump utility seems the right way to go and I just looked into the mysqldump documentation http://dev.mysql.com/doc/refman/5.5/en/mysqldump.html#option_mysqldump_set-charset and it seems it uses the utf8 character set. So my question is can I just go with

mysqldump mydatabase > dump.sql

will that do the work for me, will mysqldump automatically convert my GBK database to utf8 for me? And since all the tables used to have a bgk character set set originally, if I want to import the dump file back into another utf8 database, will that work as well?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:08:03+00:00Added an answer on May 27, 2026 at 1:08 pm

    I want to import the dump file back into another utf8 database, will
    that work as well?

    In mysql charset are assigned on many levels (connection, table, field, ecc).
    Assuming that all this levels in the old database are with charset GBK, and all this levels in the new database are with charset utf8, you just have to substitute the charset declaration for each level.

    Imagine that this is a portion of the dump file dump.sql

    CREATE TABLE IF NOT EXISTS `mytable` (
      `id` int(11) NOT NULL auto_increment,
      `myname` varchar(255) NOT NULL default '',
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=gbk AUTO_INCREMENT=1065 ;
    

    what you need is to transform it into

    CREATE TABLE IF NOT EXISTS `mytable` (
      `id` int(11) NOT NULL auto_increment,
      `myname` varchar(255) NOT NULL default '',
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1065 ;
    

    you could do this with sed

    sed -i 's/gbk/utf8/g' dump.sql
    

    now the file is ready to be correctly imported into an utf8 database

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database which contains picture data stored as a binary blob. The
I have a database table in Sql Server 2008 R2 which contains data stored
I have the following data which I want to save in my DB (this
I have a legacy database in which data is stored in a way similar
I have HTML data stored in database which I wish to display as is.
I have a setting stored in database which has a value .jpg|.gif|.png . I
I have a method which is connecting to a database via Odbc. The stored
I have an SSIS Package stored in the MSDB database which works fine when
We have a local server with an access database which feeds data to clients
I have an MySQL database which contains some data,it interacts with JSP pages,the thing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.