NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page mysql backup messed up!

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 10-02-2008, 12:33 AM THREAD STARTER               #1 (permalink)
www.bpdir.com
 
dezinerite's Avatar
Join Date: Jul 2007
Posts: 3,051
dezinerite has a reputation beyond reputedezinerite has a reputation beyond reputedezinerite has a reputation beyond reputedezinerite has a reputation beyond reputedezinerite has a reputation beyond reputedezinerite has a reputation beyond reputedezinerite has a reputation beyond reputedezinerite has a reputation beyond reputedezinerite has a reputation beyond reputedezinerite has a reputation beyond reputedezinerite has a reputation beyond repute
 



Wildlife Breast Cancer Ethan Allen Fund Tsunami Relief AIDS/HIV

Help! mysql backup messed up!


Please help!

I backed up my site's mysql database and when I reloaded the database, some letters & punctuations turned into symbols/characters.

What happened, and how can I fix this?

My site's charset is Latin1. Is there a possibility that it was somehow converted to utf8 when it was being backed up so I reloaded the utf8 instead of the Latin1?
dezinerite is offline  
Old 10-02-2008, 01:18 AM   #2 (permalink)
Part-Time Zombie
 
whitebark's Avatar
Join Date: Jul 2006
Location: Canada
Posts: 3,495
whitebark has a reputation beyond reputewhitebark has a reputation beyond reputewhitebark has a reputation beyond reputewhitebark has a reputation beyond reputewhitebark has a reputation beyond reputewhitebark has a reputation beyond reputewhitebark has a reputation beyond reputewhitebark has a reputation beyond reputewhitebark has a reputation beyond reputewhitebark has a reputation beyond reputewhitebark has a reputation beyond repute
 


Protect Our Planet
Originally Posted by dezinerite
Please help!

What happened, and how can I fix this?

????: NamePros.com http://www.namepros.com/programming/520029-mysql-backup-messed-up.html
My site's charset is Latin1. Is there a possibility that it was somehow converted to utf8 when it was being backed up so I reloaded the utf8 instead of the Latin1?
That's most likely what happened - I know as I've done it before (wrong character set). Use an earlier backup if you have one. If you don't have one, and I'm not a wizard with databases, but I'd guess you can convert it again as it is. And if not you can use a good text editor and just do a find/replace to remove/replace the characters. I recommend notetab lite. http://www.notetab.com/ntl.php
whitebark is offline  
Old 10-02-2008, 06:52 AM   #3 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
From mysql.com:

Quote:
If you want to change the table default character set and all character columns (CHAR, VARCHAR, TEXT) to a new character set, use a statement like this:
????: NamePros.com http://www.namepros.com/showthread.php?t=520029

Code:
ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
For a column that has a data type of VARCHAR or one of the TEXT types, CONVERT TO CHARACTER SET will change the data type as necessary to ensure that the new column is long enough to store as many characters as the original column. For example, a TEXT column has two length bytes, which store the byte-length of values in the column, up to a maximum of 65,535. For a latin1 TEXT column, each character requires a single byte, so the column can store up to 65,535 characters. If the column is converted to utf8, each character might require up to 3 bytes, for a maximum possible length of 3 × 65,535 = 196,605 bytes. That length will not fit in a TEXT column's length bytes, so MySQL will convert the data type to MEDIUMTEXT, which is the smallest string type for which the length bytes can record a value of 196,605. Similarly, a VARCHAR column might be converted to MEDIUMTEXT.
????: NamePros.com http://www.namepros.com/showthread.php?t=520029

To avoid data type changes of the type just described, do not use CONVERT TO CHARACTER SET. Instead, use MODIFY to change individual columns. For example:

Code:
ALTER TABLE t MODIFY latin1_text_col TEXT CHARACTER SET utf8;
ALTER TABLE t MODIFY latin1_varchar_col VARCHAR(M) CHARACTER SET utf8;
If you specify CONVERT TO CHARACTER SET binary, the CHAR, VARCHAR, and TEXT columns are converted to their corresponding binary string types (BINARY, VARBINARY, BLOB). This means that the columns no longer will have a character set and a subsequent CONVERT TO operation will not apply to them.

If charset_name is DEFAULT, the database character set is used.

Warning:
The CONVERT TO operation converts column values between the character sets. This is not what you want if you have a column in one character set (like latin1) but the stored values actually use some other, incompatible character set (like utf8). In this case, you have to do the following for each such column:

Code:
ALTER TABLE t1 CHANGE c1 c1 BLOB;
ALTER TABLE t1 CHANGE c1 c1 TEXT CHARACTER SET utf8;
The reason this works is that there is no conversion when you convert to or from BLOB columns.

To change only the default character set for a table, use this statement:

Code:
ALTER TABLE tbl_name DEFAULT CHARACTER SET charset_name;
The word DEFAULT is optional. The default character set is the character set that is used if you do not specify the character set for columns that you add to a table later (for example, with ALTER TABLE ... ADD column).
Eric is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 02:52 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger