Professional Web Applications Themes

Encoding - MySQL

I have moved DB from one to another machine, but I forgot to set up the encoding of databases, so some of them are wrong. Is it possible to change database/table/column encoding without a need of exporting data, re-create the database and importing the data? Marek Simon, Prague, Czech Republic...

  1. #1

    Default Encoding

    I have moved DB from one to another machine, but I forgot to set up the
    encoding of databases, so some of them are wrong. Is it possible to
    change database/table/column encoding without a need of exporting data,
    re-create the database and importing the data?
    Marek Simon, Prague, Czech Republic
    Marek Guest

  2. #2

    Default Re: Encoding

    Marek Simon wrote: 

    run this for your data abase:

    ALTER DATABASE db_name
    DEFAULT CHARACTER SET utf8 COLLATE utf8_persian_ci




    then run this for each table already in the database :

    ALTER TABLE table_ CONVERT TO CHARACTER SET utf8 COLLATE utf8_persian_ci;

    replace collation and/or character set as appropriate
    lark Guest

  3. #3

    Default Re: Encoding

    lark schrieb: 

    Wouldn't you have to alter the column definitions as well?
    IIRC altering the table would only change the defaults for columns that
    are added without specifying a character set and collation.

    Regards,
    Jo
    Joachim Guest

  4. #4

    Default Re: Encoding

    >> ALTER TABLE table_ CONVERT TO CHARACTER SET utf8 COLLATE 
    >
    > Wouldn't you have to alter the column definitions as well?
    > IIRC altering the table would only change the defaults for columns that
    > are added without specifying a character set and collation.[/ref]

    That is exactly what the above statement does. If you only want to
    change the default, use something like:
    ALTER TABLE table_ CHARACTER SET=utf8;

    --
    Willem Bogaerts

    Application smith
    Kratz B.V.
    http://www.kratz.nl/
    Willem Guest

Similar Threads

  1. FLV encoding
    By gorrrd in forum Macromedia Flash Flashcom
    Replies: 1
    Last Post: September 21st, 04:37 AM
  2. UTF Encoding
    By koeniga in forum Coldfusion - Advanced Techniques
    Replies: 1
    Last Post: April 27th, 06:28 AM
  3. XML and Encoding
    By Onur in forum ASP.NET General
    Replies: 2
    Last Post: August 25th, 03:09 PM
  4. Encoding md5
    By F. Potier in forum Microsoft Access
    Replies: 0
    Last Post: July 7th, 12:23 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139