SlideShare uma empresa Scribd logo
1 de 6
How to convert MySQL database from “Latin1” to “UTF8:
Once client decided to switch database from Latin1 to UTF-8.
Here I was working on a Linux platform at the time but you can do the same thing
in Windows too.
Character set and collation is possible to set at 4 levels on MySQL 5.0 version.I.e
Server, Database, Table, Column. This means that you can have a table with
character set “Latin1”, and yet set one (Or more) of its columns to have different
character sets like “UTF8”.
You can use the following commands to see what character sets are in use in your
database.
For Database Level:
SHOW VARIABLES LIKE „character_set_database‟;
(OR) SHOW CREATE DATABASE db_name;
For Table Level:
SHOW CREATE table _name;
For COLUMN Level:
SHOW CREATE table _name;
Here are the steps for I followed to convert my Latin1 Database to a UTF8
Database.
(1) Create a new Database that has UTF8 specified as its default character set.
Syntax:CREATE DATABASE new_dbname CHARACTER SET utf8
COLLATE „utf8_general_ci ‟;
(2) Export your database structure AND data by using mysqldump command.
On Linux you can do like this...
Syntax:mysqldump –uusername –ppassword latin1_db > /tmp/latindb.sql
Here Username and password are your MYSQL user name and password,
latin1_db is the name of your existing database, and latindb.sql is the name you
want to give to the backup file.
(3) Modify the SQL file you just finished exporting by opening it in any editor and
replace “CHARSET=latin1” with “CHARSET=utf8”.When you’re done with
replace, search for “latin1” to see if it shows up anywhere. You may find it in
collate statements (e.g. COLLATE=latin1_swedish_ci).
(4)If this is the case, you can either delete the collate statements, and let the tables
default to the collation set at the database level (or server level, if collation hasn’t
been specified for the database)
(5) Replace the latin1 collation with the specific utf8 collation you want to use,
save the file in ANSI format (encoding) with “Save as” and exit.
Note: ANSI is a mother character set we can say as what we have basically just
done is make sure this file is encoded using Latin1 and all the characters used in
the SQL language have the same encoding in both Latin1 and UTF8.The SQL
keywords and syntax will be interpreted properly regardless of MYSQL thinks it is
looking at Latin1 Or UTF8.
(6) Import the structure and data into your new UTF8 database which was created
in starting.
On Linux, You can use following command like
MySQL –uusername –ppassword utf_db </tmp/latindb.sql
(7) Now we just need to check data’s integrity to make sure that we are safe to go
ahead. You can also use some comparison tool for the same.
(8)If everything looks good and worked, your data is now in UTF-8 format. Use
any GUI tool for checking the data and I hope it will be in good shape.
(9) Now you can switch your application to new UTF-8 DB and check from the
application.
Second way:
1. Please make sure the database is created with character set utf8 and collation
untf8_unicode_ci.
ssh live-arccms-01
setSID live-arccms-01; getpass live-arccms-01
mQcPGoxQ3BORA9
mysql -udba_admin -p
show databases;
use nickmom(database);
[dba_admin@nickmom]> SHOW VARIABLES LIKE 'character_set_database';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| character_set_database | utf8 |
+------------------------+-------+
1 row in set (0.00 sec)
[dba_admin@nickmom]> SHOW VARIABLES LIKE 'collation_database';
+--------------------+-----------------+
| Variable_name | Value |
+--------------------+-----------------+
| collation_database | utf8_unicode_ci |
+--------------------+-----------------+
1 row in set (0.01 sec)

Mais conteúdo relacionado

Mais procurados

MDF and LDF in SQL Server
MDF and LDF in SQL ServerMDF and LDF in SQL Server
MDF and LDF in SQL ServerMasum Reza
 
Chapter 7 working with databases and my sql
Chapter 7 working with databases and my sqlChapter 7 working with databases and my sql
Chapter 7 working with databases and my sqlkausar31
 
ppt on open office.org
ppt on open office.orgppt on open office.org
ppt on open office.orgDeepansh Goel
 
Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...
Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...
Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...Massimo Cenci
 
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)Dave Stokes
 
Sql server lesson3
Sql server lesson3Sql server lesson3
Sql server lesson3Ala Qunaibi
 
Sample database design methodology
Sample database design methodologySample database design methodology
Sample database design methodologyWally Pons
 
Sql a practical introduction
Sql   a practical introductionSql   a practical introduction
Sql a practical introductionHasan Kata
 
How to recover Outlook Inbox mails
How to recover Outlook Inbox mailsHow to recover Outlook Inbox mails
How to recover Outlook Inbox mailsjohnmerlin955
 
Get rid off Outlook Error
Get rid off Outlook ErrorGet rid off Outlook Error
Get rid off Outlook Errorjohnmerlin955
 
Distributed Database using-Horizontal Fagmentation
Distributed Database using-Horizontal FagmentationDistributed Database using-Horizontal Fagmentation
Distributed Database using-Horizontal FagmentationYashashreeMangela
 

Mais procurados (12)

MDF and LDF in SQL Server
MDF and LDF in SQL ServerMDF and LDF in SQL Server
MDF and LDF in SQL Server
 
Chapter 7 working with databases and my sql
Chapter 7 working with databases and my sqlChapter 7 working with databases and my sql
Chapter 7 working with databases and my sql
 
ppt on open office.org
ppt on open office.orgppt on open office.org
ppt on open office.org
 
Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...
Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...
Recipes 8 of Data Warehouse and Business Intelligence - Naming convention tec...
 
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
 
ELF
ELFELF
ELF
 
Sql server lesson3
Sql server lesson3Sql server lesson3
Sql server lesson3
 
Sample database design methodology
Sample database design methodologySample database design methodology
Sample database design methodology
 
Sql a practical introduction
Sql   a practical introductionSql   a practical introduction
Sql a practical introduction
 
How to recover Outlook Inbox mails
How to recover Outlook Inbox mailsHow to recover Outlook Inbox mails
How to recover Outlook Inbox mails
 
Get rid off Outlook Error
Get rid off Outlook ErrorGet rid off Outlook Error
Get rid off Outlook Error
 
Distributed Database using-Horizontal Fagmentation
Distributed Database using-Horizontal FagmentationDistributed Database using-Horizontal Fagmentation
Distributed Database using-Horizontal Fagmentation
 

Destaque

My sql storage engines
My sql storage enginesMy sql storage engines
My sql storage enginesVasudeva Rao
 
Mater,slave on mysql
Mater,slave on mysqlMater,slave on mysql
Mater,slave on mysqlVasudeva Rao
 
Upgrading mysql version 5.5.30 to 5.6.10
Upgrading mysql version 5.5.30 to 5.6.10Upgrading mysql version 5.5.30 to 5.6.10
Upgrading mysql version 5.5.30 to 5.6.10Vasudeva Rao
 
Postgre sql run book
Postgre sql run bookPostgre sql run book
Postgre sql run bookVasudeva Rao
 
9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linux9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linuxchinkshady
 
Performence tuning
Performence tuningPerformence tuning
Performence tuningVasudeva Rao
 
Database migration
Database migrationDatabase migration
Database migrationVasudeva Rao
 
Inno db datafiles backup and retore
Inno db datafiles backup and retoreInno db datafiles backup and retore
Inno db datafiles backup and retoreVasudeva Rao
 
MySQL Crash Course, Chapter 1
MySQL Crash Course, Chapter 1MySQL Crash Course, Chapter 1
MySQL Crash Course, Chapter 1Gene Babon
 
Mysql data replication
Mysql data replicationMysql data replication
Mysql data replicationTuấn Ngô
 
All types of backups and restore
All types of backups and restoreAll types of backups and restore
All types of backups and restoreVasudeva Rao
 
Teaching PostgreSQL to new people
Teaching PostgreSQL to new peopleTeaching PostgreSQL to new people
Teaching PostgreSQL to new peopleTomek Borek
 

Destaque (13)

My sql storage engines
My sql storage enginesMy sql storage engines
My sql storage engines
 
Mater,slave on mysql
Mater,slave on mysqlMater,slave on mysql
Mater,slave on mysql
 
Upgrading mysql version 5.5.30 to 5.6.10
Upgrading mysql version 5.5.30 to 5.6.10Upgrading mysql version 5.5.30 to 5.6.10
Upgrading mysql version 5.5.30 to 5.6.10
 
Postgre sql run book
Postgre sql run bookPostgre sql run book
Postgre sql run book
 
9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linux9 steps to install and configure postgre sql from source on linux
9 steps to install and configure postgre sql from source on linux
 
Performence tuning
Performence tuningPerformence tuning
Performence tuning
 
Database migration
Database migrationDatabase migration
Database migration
 
Inno db datafiles backup and retore
Inno db datafiles backup and retoreInno db datafiles backup and retore
Inno db datafiles backup and retore
 
MySQL Crash Course, Chapter 1
MySQL Crash Course, Chapter 1MySQL Crash Course, Chapter 1
MySQL Crash Course, Chapter 1
 
Mysql data replication
Mysql data replicationMysql data replication
Mysql data replication
 
Ddl commands
Ddl commandsDdl commands
Ddl commands
 
All types of backups and restore
All types of backups and restoreAll types of backups and restore
All types of backups and restore
 
Teaching PostgreSQL to new people
Teaching PostgreSQL to new peopleTeaching PostgreSQL to new people
Teaching PostgreSQL to new people
 

Semelhante a Convert language latin1 to utf8 on mysql

Automating Test File Creation
Automating Test File CreationAutomating Test File Creation
Automating Test File Creationbdebruin
 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredDanish Mehraj
 
Introduction of ssis
Introduction of ssisIntroduction of ssis
Introduction of ssisdeepakk073
 
My sql with querys
My sql with querysMy sql with querys
My sql with querysNIRMAL FELIX
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database DeploymentsMike Willbanks
 
Introduction4 SQLite
Introduction4 SQLiteIntroduction4 SQLite
Introduction4 SQLiteStanley Huang
 
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!Amanda Lam
 
Migrating from PHP 4 to PHP 5
Migrating from PHP 4 to PHP 5Migrating from PHP 4 to PHP 5
Migrating from PHP 4 to PHP 5John Coggeshall
 
cPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven FeaturescPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven FeaturesDave Stokes
 
Sql introduction
Sql introductionSql introduction
Sql introductionvimal_guru
 
9780538745840 ppt ch07
9780538745840 ppt ch079780538745840 ppt ch07
9780538745840 ppt ch07Terry Yoast
 
OVERVIEW OF NEW SQL,COMPARING SQL,NOSQL AND NEWSQL,B.Vinithamani,II-M.sc(Comp...
OVERVIEW OF NEW SQL,COMPARING SQL,NOSQL AND NEWSQL,B.Vinithamani,II-M.sc(Comp...OVERVIEW OF NEW SQL,COMPARING SQL,NOSQL AND NEWSQL,B.Vinithamani,II-M.sc(Comp...
OVERVIEW OF NEW SQL,COMPARING SQL,NOSQL AND NEWSQL,B.Vinithamani,II-M.sc(Comp...vinithabalasubramani1
 

Semelhante a Convert language latin1 to utf8 on mysql (20)

Pl ams 2015_unicode_dveeden
Pl ams 2015_unicode_dveedenPl ams 2015_unicode_dveeden
Pl ams 2015_unicode_dveeden
 
Readme
ReadmeReadme
Readme
 
Automating Test File Creation
Automating Test File CreationAutomating Test File Creation
Automating Test File Creation
 
Migration from 8.1 to 11.3
Migration from 8.1 to 11.3Migration from 8.1 to 11.3
Migration from 8.1 to 11.3
 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
 
Introduction of ssis
Introduction of ssisIntroduction of ssis
Introduction of ssis
 
My sql with querys
My sql with querysMy sql with querys
My sql with querys
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
 
Introduction4 SQLite
Introduction4 SQLiteIntroduction4 SQLite
Introduction4 SQLite
 
Database Management Assignment Help
Database Management Assignment Help Database Management Assignment Help
Database Management Assignment Help
 
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
 
Migrating from PHP 4 to PHP 5
Migrating from PHP 4 to PHP 5Migrating from PHP 4 to PHP 5
Migrating from PHP 4 to PHP 5
 
cPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven FeaturescPanel now supports MySQL 8.0 - My Top Seven Features
cPanel now supports MySQL 8.0 - My Top Seven Features
 
My sql.ppt
My sql.pptMy sql.ppt
My sql.ppt
 
Sql introduction
Sql introductionSql introduction
Sql introduction
 
Mysql tutorial 5257
Mysql tutorial 5257Mysql tutorial 5257
Mysql tutorial 5257
 
Lab 1 Essay
Lab 1 EssayLab 1 Essay
Lab 1 Essay
 
9780538745840 ppt ch07
9780538745840 ppt ch079780538745840 ppt ch07
9780538745840 ppt ch07
 
OVERVIEW OF NEW SQL,COMPARING SQL,NOSQL AND NEWSQL,B.Vinithamani,II-M.sc(Comp...
OVERVIEW OF NEW SQL,COMPARING SQL,NOSQL AND NEWSQL,B.Vinithamani,II-M.sc(Comp...OVERVIEW OF NEW SQL,COMPARING SQL,NOSQL AND NEWSQL,B.Vinithamani,II-M.sc(Comp...
OVERVIEW OF NEW SQL,COMPARING SQL,NOSQL AND NEWSQL,B.Vinithamani,II-M.sc(Comp...
 
Mysql tutorial
Mysql tutorialMysql tutorial
Mysql tutorial
 

Último

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 

Último (20)

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 

Convert language latin1 to utf8 on mysql

  • 1. How to convert MySQL database from “Latin1” to “UTF8: Once client decided to switch database from Latin1 to UTF-8. Here I was working on a Linux platform at the time but you can do the same thing in Windows too. Character set and collation is possible to set at 4 levels on MySQL 5.0 version.I.e Server, Database, Table, Column. This means that you can have a table with character set “Latin1”, and yet set one (Or more) of its columns to have different character sets like “UTF8”. You can use the following commands to see what character sets are in use in your database. For Database Level: SHOW VARIABLES LIKE „character_set_database‟; (OR) SHOW CREATE DATABASE db_name; For Table Level: SHOW CREATE table _name;
  • 2. For COLUMN Level: SHOW CREATE table _name; Here are the steps for I followed to convert my Latin1 Database to a UTF8 Database. (1) Create a new Database that has UTF8 specified as its default character set. Syntax:CREATE DATABASE new_dbname CHARACTER SET utf8 COLLATE „utf8_general_ci ‟; (2) Export your database structure AND data by using mysqldump command. On Linux you can do like this... Syntax:mysqldump –uusername –ppassword latin1_db > /tmp/latindb.sql Here Username and password are your MYSQL user name and password, latin1_db is the name of your existing database, and latindb.sql is the name you want to give to the backup file. (3) Modify the SQL file you just finished exporting by opening it in any editor and replace “CHARSET=latin1” with “CHARSET=utf8”.When you’re done with replace, search for “latin1” to see if it shows up anywhere. You may find it in collate statements (e.g. COLLATE=latin1_swedish_ci). (4)If this is the case, you can either delete the collate statements, and let the tables default to the collation set at the database level (or server level, if collation hasn’t been specified for the database)
  • 3. (5) Replace the latin1 collation with the specific utf8 collation you want to use, save the file in ANSI format (encoding) with “Save as” and exit. Note: ANSI is a mother character set we can say as what we have basically just done is make sure this file is encoded using Latin1 and all the characters used in the SQL language have the same encoding in both Latin1 and UTF8.The SQL keywords and syntax will be interpreted properly regardless of MYSQL thinks it is looking at Latin1 Or UTF8.
  • 4. (6) Import the structure and data into your new UTF8 database which was created in starting. On Linux, You can use following command like MySQL –uusername –ppassword utf_db </tmp/latindb.sql (7) Now we just need to check data’s integrity to make sure that we are safe to go ahead. You can also use some comparison tool for the same. (8)If everything looks good and worked, your data is now in UTF-8 format. Use any GUI tool for checking the data and I hope it will be in good shape.
  • 5. (9) Now you can switch your application to new UTF-8 DB and check from the application.
  • 6. Second way: 1. Please make sure the database is created with character set utf8 and collation untf8_unicode_ci. ssh live-arccms-01 setSID live-arccms-01; getpass live-arccms-01 mQcPGoxQ3BORA9 mysql -udba_admin -p show databases; use nickmom(database); [dba_admin@nickmom]> SHOW VARIABLES LIKE 'character_set_database'; +------------------------+-------+ | Variable_name | Value | +------------------------+-------+ | character_set_database | utf8 | +------------------------+-------+ 1 row in set (0.00 sec) [dba_admin@nickmom]> SHOW VARIABLES LIKE 'collation_database'; +--------------------+-----------------+ | Variable_name | Value | +--------------------+-----------------+ | collation_database | utf8_unicode_ci | +--------------------+-----------------+ 1 row in set (0.01 sec)