Your HostICan Community  


Go Back   Your HostICan Community > Programming & Design > PHP / MySQL Assistance

PHP / MySQL Assistance We understand. Not all of you are experienced programmers, but some of you are highly skilled at coding. So we've set aside this forum so you can ask questions, and provide answers to the most commonly asked PHP / MySQL issues.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-20-2009, 02:23 PM
valila valila is offline
Junior Member
 
Join Date: Aug 2009
Posts: 2
Default import utf8 MySQL encoding by default to my hosting

How do I set MySQL to import utf8 encoding by default? I made test on many scripts, but alas there cannot find a simple command which may do it to my hosting MySQL database.
Reply With Quote
  #2  
Old 08-20-2009, 04:31 PM
misterhard's Avatar
misterhard misterhard is offline
Junior Member
 
Join Date: Jan 2009
Location: Portuguese Republic
Posts: 7
Default Re: import utf8 MySQL encoding by default to my hosting

You must configure what encoding to use your connection.
Code:
#mysql
SET NAMES UTF8;
source path_to_sql_file.sql
This will fulfil query in the SQL file, and if has inserting will be inserted with the upper encoding. If you are using phpMyAdmin - at the top has drop-down menu for selecting the encoding.
Reply With Quote
  #3  
Old 08-22-2009, 11:47 AM
KODY's Avatar
KODY KODY is offline
Junior Member
 
Join Date: Jan 2009
Posts: 20
Default Re: import utf8 MySQL encoding by default to my hosting

Open the file called my.cnf and within the section [client] write a line:
Sample code:
Code:
default-character-set=utf8
and within the section [mysqld] write these lines:
Sample code:
Code:
default-character-set=utf8
init-connect="SET NAMES utf8"
Restart MySQL and everything should be fine. Previously made backup of all databases.
Reply With Quote
  #4  
Old 08-31-2009, 02:44 AM
carlobee carlobee is offline
Senior Member
 
Join Date: Jul 2009
Posts: 163
Default Re: import utf8 MySQL encoding by default to my hosting

this is a very useful information! thanks for this one.

Reply With Quote
Reply

Tags
default, encoding, hosting, import, mysql, utf8

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 06:09 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Copyright © 2003 - 2008 HostICan. All Rights Reserved.