SlideShare ist ein Scribd-Unternehmen logo
1 von 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)

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 

Kürzlich hochgeladen (20)

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 

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)