Wednesday, November 20, 2019

MySQL : Converting Table Character Sets From latin1 to utf8

Let's assume we were using latin1 for the database and client character set. Even though latin1 is a single-byte character set, we can still insert multi-byte characters because of double-encoding.
mysql --user=root --password


CREATE DATABASE char_test_db;
USE char_test_db;

DROP TABLE IF EXISTS t1;

CREATE TABLE t1 (
  id          INT(11) NOT NULL AUTO_INCREMENT,
  description VARCHAR(50),
  PRIMARY KEY(id)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;

SET NAMES latin1;

INSERT INTO t1 (description) VALUES ('¡Volcán!');

SELECT id, description, HEX(description) FROM t1;
+----+-------------+----------------------+
| id | description | HEX(description)     |
+----+-------------+----------------------+
|  1 | ¡Volcán!    | C2A1566F6C63C3A16E21 |
+----+-------------+----------------------+
1 row in set (0.00 sec)

mysql>
Due to the amount of multi-byte information coming in, we now decide we need to switch to utf8 as the character set for the database and client. That's a simple change.
SET NAMES utf8;

ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;

SELECT id, description, HEX(description) FROM t1;
+----+----------------+------------------------------+
| id | description    | HEX(description)             |
+----+----------------+------------------------------+
|  1 | ¡Volcán!     | C382C2A1566F6C63C383C2A16E21 |
+----+----------------+------------------------------+
1 row in set (0.01 sec)

mysql>
Unfortunately, we've mangled the data. If we switch the client back to latin1, the data looks OK though.
SET NAMES latin1;

SELECT id, description, HEX(description) FROM t1;
+----+-------------+------------------------------+
| id | description | HEX(description)             |
+----+-------------+------------------------------+
|  1 | ¡Volcán!    | C382C2A1566F6C63C383C2A16E21 |
+----+-------------+------------------------------+
1 row in set (0.00 sec)

mysql>

The Solution

Recreate the table in its original state.
DROP TABLE IF EXISTS t1;

CREATE TABLE t1 (
  id          INT(11) NOT NULL AUTO_INCREMENT,
  description VARCHAR(50),
  PRIMARY KEY(id)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;

SET NAMES latin1;

INSERT INTO t1 (description) VALUES ('¡Volcán!');

SELECT id, description, HEX(description) FROM t1;
+----+-------------+----------------------+
| id | description | HEX(description)     |
+----+-------------+----------------------+
|  1 | ¡Volcán!    | C2A1566F6C63C3A16E21 |
+----+-------------+----------------------+
1 row in set (0.00 sec)

mysql>
A better way to convert the character set of the table is to first convert the description column to a BLOB. BLOB data has no associated character set, so it is unchanged by the conversion of the table character set. We can then safely convert the character set of the table and convert the description column back to its original data type.
SET NAMES utf8;
ALTER TABLE t1 CHANGE description description BLOB;
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8, CHANGE description description VARCHAR(50);
Now the data looks fine when viewed from a utf8 client.
SET NAMES utf8;

SELECT id, description, HEX(description) FROM t1;
+----+-------------+----------------------+
| id | description | HEX(description)     |
+----+-------------+----------------------+
|  1 | ¡Volcán!    | C2A1566F6C63C3A16E21 |
+----+-------------+----------------------+
1 row in set (0.01 sec)

mysql>
As you might expect, the data will look a little mangled from a latin1 client though!
SET NAMES latin1;

SELECT id, description, HEX(description) FROM t1;
+----+-------------+----------------------+
| id | description | HEX(description)     |
+----+-------------+----------------------+
|  1 | �Volc�n!    | C2A1566F6C63C3A16E21 |
+----+-------------+----------------------+
1 row in set (0.00 sec)

mysql>

Monday, October 28, 2019

15 Best MySQL GUI Tools Roundup

If you’re like most of our customers, you’re probably using MySQL.
There are two ways you can manage MySQL.
  1. Command line
  2. GUI tool
Using command line is fine for certain situations, but overall, using a GUI can save a lot of time and is much easier to work with. But with so many available tools, which one should you choose?
This blog post will review (in our opinion) the 15 best MySQL GUI tools.
Hopefully, it can help you choose the right one for your needs.

MySQL GUI Tools Reviewed

phpMyAdmin

Initially released back in the 1998 phpMyAdmin was written in PHP in order to handle MySQL and MariaDB inside the web browser.
Today it is one of the most popular tools that manage MySQL database administration. It has enough functionality to create a website without technical knowledge of MYSQL. 
It is free to try and use but author encourages donations that can enhance the software. It’s widely used to manage databases, tables, relations, users and much more.

PROS

  • Easy to install and manage hosting environments
  • Innovative and Simple
  • Since it is web-based, it can be accessed from nearly any computer.

CONS

  • SQL syntaxes aren’t highlighted
Download

MYDB Studio

mydb studio
MYDB studio was released in 2004. It offers a handy collection of tools for MySQL server administration. Users can use it to create, edit and drop database objects. It has a simple Graphical User Interface which allows users to get used to it with ease.
It features the ability to create PHP scripts and has a built-in browser that lets you search manually. It is free but in order to get a free license, you need to register.

PROS

  • Handy administration tools
  • PHP builder is included

CONS:

  • In order to use it for free, the user must register.
Download

HeidSQL

heidi sql
HeidiSQL got released as a stable open-source tool in 2015. It is handy and used widely by web developers and it’s available on OSX and Windows. 
It offers tools such as editing data, browsing data and lets the user create the tables and modify them. It is very popular because of its portability, lightweight, and ease of use. 
More importantly, this tool is freeware, attracting various developers and database administrators.

PROS

  • Portable, lightweight and easy to install and use
  • Offers syntax completion, data synchronization and has great user management

CONS

  • Unfortunately, it works slower and tends to crash when there’s too much data used.
Download

MySQL Workbench

mysql workbench
MySQL Workbench is a visual tool for database architects and developer. It offers administration tools for server configuration, user administration and much more.
It is available on Windows, Linux, and MAC OS X.
It is recommended for anyone who wants to master Database administration. It came out as a stable tool in October 2016.

PROS

  • It saves SQL statements
  • It offers offline access to remote DB’s
  • It stores multiple connections inside one location

CONS

  • It is more complex compared to Phpmyadmin.
Download

Sequel Pro

sequel pro
Sequel Pro is an open-source application that enables the user to build sites for free. However, it is widely used by programmers and software developers as well.
Unfortunately, it is available only for MAC OS X so windows users have to turn to some other open-source application. It is free but author encourages donation.

PROS

  • SQL queries are being run from menus
  • Easily connects to the databases using TCP/IP protocol

CONS

  • It is not available for other operating systems.
  • Not as good as PHPMyAdmin
Download

Navicat

navicat
Navicat offers decent features and options for database administrators and developers. It runs exceptionally on all windows operating, starting from Windows XP SP3, but it runs pretty decently on Linux and Mac OS X. It has a rich set of features and it is very responsive and innovative.
This software isn’t free, but it offers a 14-day free trial so the potential users can try it out. Its been available since 2001. Definitely popular with the “old timers.”

PROS

  • Devoted customer support staff.
  • Large set of features and options for its users
  • Secure connections

CONS

  • It is not free
Download

Database Master

database master
Database Master offers a large set of features and options that any database administrator would love to have. It does everything that is expected from the program. It is limited to Windows and isn’t freeware. It is used for creating, editing, and dropping database objects.

PROS

  • A lot of details, very innovative and trivial

CONS:

  • It is not freeware but offers a trial version.
  • Limited to Windows
Download

dbForge Studio

dbforge studio
DbForge studio is an integrated environment for MYSQL. This GUI is handy for managing databases, developing and editing MYSQL. It enables users to create and run queries inside a comfortable environment.
Although it’s not for free and costs around $150, it is very convenient and has a lot to offer. It was found in 1997 in the Czech Republic.

PROS

  • Offers proficient customer support
  • Has innovative UI and UX
  • Various features and settings

CONS

  • It isn’t free
  • Customer Support is limited to the business hours
  • Limited to Windows.
Download

SQLyog

sqlyog
This software comes in 3 packages Professional, Enterprise, and Pro. However, you can choose one of the 3 packages after trying it out as a trial.
SQL database administrators can trust it to perform well, without too many bugs and ease of use. This is another feature that is only available for Windows, so OS X and Linux users will have to look elsewhere.

PROS

  • Innovative, smooth query designer
  • Although it’s very expensive, all its features are worth the price

CONS

  • Only available for Windows
Download

MySQL Front

mysql frontReleased back in 2012 is Windows’ front end for the MYSQL server. Many database administrators and developers use it in their endeavors, as much as web designers and developers. It can be used for importing and exporting data as SQL files, CSV file format, HTML, XML and much more.
Just like other enhanced GUI applications, this one isn’t free, but it offers a free trial.

PROS

  • It supports importing and exporting in standard file types
  • It has a lot of features that enhance the quality of database

CONS

  • Another feature that is available only for Windows operating system
  • It’s not free.
Download

DbVizualizer

db visualizer
This program is free and available for all operating systems Windows, Mac OS X, Linux, and Unix. It was launched in 2015 and is handy for database developers, web developers, and analysts.
It offers a wide range of features and settings that support database development and maintenance. The base version is free, but you can upgrade it to a pro version which has more features.

PROS

  • Search box that highlights matching rows
  • Easy to use, very flexible and ensures simple data recovery.

CONS

  • Pro version is quite expensive and not worth the fuss.
Download

Valentina Studio

valentina studios
This powerful GUI operates with special Valentina databases, MYSQL and MariaDB. It is available for OS X, Windows, and Linux, and it also features iValentina version for iPhone and iPad.
It operates with various queries, lets you create and maintain databases, queries, relations, and much more.
The basic package is for free, and it is dedicated to the users that would like to learn more. More advanced packages ( Pro -$ 199.9, Universal -$399.9) are recommended for professionals.

PROS

  • Valentina Studio has a fresh, intuitive and responsive user interface.
  • It is a cross-platform application

CONS

  • We haven’t noticed significant issues that would affect user experience, except that pro and universal versions have much more to offer, but are much more expensive.
Download

Querious

querious
This tool enables the user to monitor, maintain, develop and design MYSQL databases but also MariaDB with ease. It has extremely easy and innovative user interface and is dedicated to anyone who wants to master this branch of IT. It can import and export files in SQL and CSV format and much more.
This software is not for free.
It costs $25 USD and offers a free trial that lasts 30 days. Also, Querious is available only for MAC OS X.

PROS

  • The full price of this product isn’t as high as it is on other products.
  • It gives professional user experience and editing.
  • Top-notch import and export functionality

CONS

  • It is available only for Mac os x.
Download

Aqua Studio

aqua data studio
Aqua Studio is an extremely popular and useful tool that assists database developers, web developers, and analysts. It has high-quality functionality, it is easy to install and use if you possess the knowledge. It offers a lot of features and functions and has highly responsive customer support.

PROS

  • Aqua Data Studio makes creating and running queries very easy and is intuitive towards beginners.

CONS

  • It is way too expensive for what it has to offer.
  • It requires a lot of technical knowledge in order to master it.
Download

Toad for MYSQL

toad mysql
Many database and web developers refer to Toad feature for MYSQL, especially Oracle developers. It makes coding and creating databases easier and more efficient in the process.
It was released in December 2014 and it is available for all versions of Windows starting from Windows 98. The best part is that this software is completely free.

PROS

  • It installs quickly.
  • It is very easy to use, especially with its user-friendly interface.
  • It offers many options and features that enhance user experience.

CONS

  • It can get buggy, even on a PC with high-end specifications.

MySQL: The most popular database worldwide

MySQL: The most popular database worldwide

Disclaimer: charts and data copyrights are of StackOverflow.

10 Best MySQL GUI Tools

10 Best MySQL GUI Tools

 Total: 3 Average: 4.3
MySQL is among most widely-used and popular database technologies, so quite a lot of tools have been created in order to make the processes of designing, creating, and administering databases easier and more convenient. However, with all of the possible options, it can be difficult to choose one tool that will fit your requirements best. That is why I prepared a list of 10 MySQL GUI tools that, in my opinion, are the best solutions both for developers and DBAs alike.
Let’s take a closer look at them.

dbForge Studio for MySQL

dbForge Studio

This multi-purpose GUI tool is an IDE that comprises a wide range of features and functionality necessary for MySQL database development and maintenance. It allows you to create and execute queries, develop and debug stored routines, automate database object management, analyze table data via an intuitive interface, and much more.
In addition to dbForge Studio, Devart offers various standalone MySQL developer tools, which you can check here.
Pros:
• Rich code formatting functionality that allows to create and modify code profiles to standardize your code and make it as clean as possible
 MariaDB databases are supported
• Ability to create result scripts for SELECT, INSERT, UPDATE, and DELETE statements to a SQL file with the help of the CRUD Generator

MySQL Workbench

MySQL Workbench
MySQL Workbench is a unified visual tool for database architects, developers, and DBAs. It provides various functionality for designing, developing, and administering databases. It’s available in 3 editions – Community, Standard, and Enterprise. Community is a free open-source edition offering a basic set of features, and the remaining two are commercial editions with extended functionality.
Pros:
• Allows to see server status and health, as well as server logs
• Developed by Oracle, the company behind MySQL itself, so you can be sure MySQL Workbench will be compatible with all recent features of MySQL
• Available for Windows, Linux, and Mac OS X

phpMyAdmin

phpMyAdmin
phpMyAdmin is a web-based MySQL administration tool written in PHP. It’s one of the most popular tools of its kind, mainly due to how easy it is to use and the fact that it’s completely free. It may lack some advanced features other tools provide, but its basic functionality is enough to help you create functioning websites without advanced knowledge of MySQL.
Pros:
• Can be easily accessed from most computers because it’s web-based
 Simple to install and use
• Available in 80 languages – both left-to-right and right-to-left ones

HeidiSQL

HeidiSQL
HeidiSQL is a lightweight freeware tool for working with databases, be it browsing or editing data, creating and modifying tables, managing user privileges, or other tasks. In addition to Windows, it works with Linux distributions but will require the Wine platform in this case.
Pros:
• Can connect to MySQL databases through an SSH tunnel.
• Allows to batch-insert ASCII and binary files into tables
• Available in a portable version which doesn’t require installation or administrative privileges

Toad Edge for MySQL

Toad Edge for MySQL
Toad Edge for MySQL provides a toolset for database development and administration with features such as schema comparison and synchronization, SQL query monitor, robust data import and export, database snapshot creation, advanced JSON editor, and more. Toad Edge is available for Windows and Mac OS X.
Pros:
• Powerful JSON data browser/editor functionality
• Session viewer that allows to track current sessions, terminate them, or cancel queries
• Round-the-clock user support

SQLyog

SQLyog
SQLyog is a MySQL management solution for Windows available in three paid editions. It also has a free trial which allows you to test the software before purchasing a license. Its extensive feature list makes up for the fact that it’s not accessible for free – you can synchronize data and schemas, perform scheduled backups, import external data, and much more.
Pros:
• Customizable user interface with various themes
• Multi-threaded query execution
• Shortcuts which allow generating SQL DML statements from the schema definition

Navicat for MySQL

Navicat for MySQL
Navicat for MySQL is a set of tools for database developers and administrators which is compatible with MySQL, MariaDB, and cloud databases. A wide range of features provides the ability to simplify the database development process and increase your productivity when working on various management and administration tasks. This tool comes in three paid editions and has a 14-day fully functional free trial to help you evaluate its functionality.
Pros:
• Available for Windows, Mac OS X, and Linux
• Allows synchronizing your connection settings, models, queries, and virtual groups to the Navicat Cloud so you can share them with your coworkers at any time, from any place.
• Ability to print schedule reports in the Windows edition

Aqua Data Studio

Aqua Data Studio
Aqua Data Studio is a versatile IDE for relational, cloud, and NoSQL databases with powerful visual data analysis functionality. It allows you to visually build queries, model entity relationship diagrams, edit data in an Excel-style grid, and perform other database development and administration tasks.
Pros:
• Create engaging visualizations of data and share them with colleagues and customers with the help of the tool’s robust visual analytics capabilities
• Develop and debug scripts in a scripting development environment with a set of open APIs
• View query execution plans and their statistics to understand how to increase overall server performance

Valentina Studio

Valentina Studio
This GUI tool allows you to create and maintain databases, queries, object relations, and more. The free edition comprises basic functionality such as editing schemas and creating diagrams for them, server administration, code completion, etc. The paid Pro version provides additional features such as the report designer, query builder, and others.
Pros:
• Provides various database continuous integration tools
• Supports Valentina databases which feature the unique Abstraction Links – they allow developers to use both API and SQL commands to create, delete and modify links between tables, link and unlink records, and more.
• Has a free iOS version

Sequel Pro

Sequel Pro
Sequel Pro is a free MySQL database management tool which allows performing all basic tasks such as adding, modifying, removing, browsing, and filtering databases, tables, and records, running queries, and more. While other MySQL tools we looked at are available for Windows and other OS, Sequel Pro will only work on Mac OS X. This tool is the successor of the CocoaMySQL database management application.
Pros:
• Easily connects to databases through the TCP/IP protocol
• Supports all MySQL versions starting from 3.x
• Lightweight and easy to use

Conclusion

I presented some information about various GUI tools designed for working with MySQL and facilitating your database development and management processes. These tools and their editions can be divided into two categories: free and paid.
If you only need the essential functionality for your database development and/or your goal is to get familiar with MySQL databases and improve your skills, a freeware tool from one of those we mentioned would be a great choice – for example, HeidiSQL, the free edition of SQL Workbench, Sequel Pro if you’re working on Mac OS X, etc.
On the other hand, if you need extended functionality that will help in any part of the database lifecycle for the most productive and high-quality development and administration, it’s highly recommended to consider some of the MySQL tools for Windows (and other OS) such as the dbForge Studio IDE, Navicat, Toad Edge, or others as they provide the widest range of capabilities.