Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 18
  1. #1
    Member
    Join Date
    Jul 2004
    Posts
    44

    Default default MySQL collation and character set / charset

    running mysql 5 and php 5

    i need to have mysql run as utf-8. Problem is that there are a number of sites on the server that are older and still using latin-1.

    is there a way to enable mysql to use utf-8 on a per-site basis?

  2. #2
    Member WebScHoLaR's Avatar
    Join Date
    Dec 2005
    Location
    Planet Earth
    Posts
    506

    Regards,
    WebScHoLaR

    WebHosting Blog: http://WebScHoLaR.net

  3. #3
    Member
    Join Date
    Jul 2004
    Posts
    44

    Default

    Thanks. I already did that. It didn't help, so I upgraded to mysql 5. That didn't help, so here I am

  4. #4
    Member
    Join Date
    Sep 2003
    Location
    San Antonio
    Posts
    33

    Default mysql default charset

    How can I have cpanel create databases with a default charset of utf8 and collation of utf8_unicode_ci?

  5. #5
    Member
    Join Date
    Sep 2003
    Location
    San Antonio
    Posts
    33

    Default

    Nevermind, I figured this out.


    Add this line to your my.cnf file

    default-character-set=utf8

    Amazingly simple really.

  6. #6
    Member
    Join Date
    Jan 2006
    Posts
    150
    cPanel/Enkompass Access Level

    Root Administrator

    Default .my.cnf in user's home dir?

    I would like to change mysql default charset for some user and I know that I sould be able to do that with .my.cnf file in user's home dir but I just can't get that to work. Whatever I put there it's just ignored.

    Can someone please help with this?

  7. #7
    cPanel Development cpanelkenneth's Avatar
    Join Date
    Apr 2006
    Posts
    3,788
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by dexus View Post
    I would like to change mysql default charset for some user and I know that I sould be able to do that with .my.cnf file in user's home dir but I just can't get that to work. Whatever I put there it's just ignored.

    Can someone please help with this?
    That file is only used by the mysql command line client. For connects via PHP, or other programming language, the change needs to happen during the connection. The details will vary according to language and application.

    Now, if you mean to influence the cPanel functions, our functions only use the user, host and password values in that file.

  8. #8
    Member
    Join Date
    Jan 2006
    Posts
    150
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    I am not shure that I understood... So there is no way to change default database character set that will be created by cPanel per user only.

    I would just like that cPanel or Fantastico create a database with utf8 character set as default just for some users.

    Is that possible?

    Thanks.

  9. #9
    Member
    Join Date
    Sep 2008
    Posts
    19

    Default

    I would also like to do this. Is it possible to set the default charset to utf8 and not have it overwritten by updates from cpanel?

  10. #10
    cPanel Development cpanelkenneth's Avatar
    Join Date
    Apr 2006
    Posts
    3,788
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Set the default encoding and collation in /etc/my.cnf, then restart the mysql service.

  11. #11
    Member
    Join Date
    Sep 2008
    Posts
    19

    Default

    Thanks, Kenneth!

  12. #12
    Member SageBrian's Avatar
    Join Date
    Jun 2002
    Location
    NY/CT (US)
    Posts
    386

    Default

    for those looking for recent info for mysql 5.1.x,
    I added this to etc/my.cnf

    [mysqld]
    collation_server=utf8_unicode_ci
    character_set_server=utf8

    After saving and restarting mysql service, I went create a new database using Fantastico (Joomla 1.5 install), and it was now in the proper uft8 format.
    Have your own Personal Web Address yet? GetMyFamilyName.com
    On this forum nobody needs Professional Website Management, but I put this for silly PR - SevenSages.com

  13. #13
    cPanel Quality Assurance Analyst cPanelDon's Avatar
    Join Date
    Nov 2008
    Location
    Houston, Texas, U.S.A.
    Posts
    2,555
    cPanel/Enkompass Access Level

    DataCenter Provider

    Arrow Friendly Moderator Note

    To better organize related discussions I have merged a few different threads that pertain to the same topic about setting a default character set and or default collation in MySQL.
    Last edited by cPanelDon; 08-26-2010 at 05:36 PM. Reason: Correction of typo

  14. #14
    Member
    Join Date
    Dec 2009
    Posts
    17

    Default Re: default MySQL collation and character set / charset

    Sorry for bumping this up, but i have a question. If i add collation_server=utf8_unicode_ci and character_set_server=utf8 to my.cnf in order to change charset and collation for new databases will there be any problems with databases already created as latin1?

  15. #15
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: default MySQL collation and character set / charset

    Actually, I'm going to revise my prior entry as it might pose an issue to have different character sets for different MySQL databases if the character set hasn't been hard coded for the older databases. It would be better to convert the older databases to the new character set if possible. There is a good article on converting the character set for an existing database at this location:

    http://codex.wordpress.org/Convertin...Character_Sets

    Next, please ensure you are running MySQL 5.1 if you are using those variables.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads & Tags
Similar threads

  1. default MySQL collation and character set / charset
    By tgavin in forum cPanel and WHM Discussions
    Replies: 12
    Last Post: 08-26-2010, 05:32 PM
  2. Default Character Set in Autoresponder
    By tonedog in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 09-22-2008, 10:05 AM
  3. Mysql character set / collation problem with Cpanel
    By bonis in forum New User Questions
    Replies: 0
    Last Post: 06-07-2008, 09:03 PM
  4. Default character set for new databases
    By remik in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 08-14-2007, 08:48 PM
  5. apache error log: Character set '#17' is not a compiled character set and is not spec
    By esupport.org.ua in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 06-03-2005, 05:25 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube