SOURCE CODE OF SQL FILE IS:
-- phpMyAdmin SQL Dump
-- version 4.0.4.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Oct 20, 2021 at 07:03 PM
-- Server version: 5.5.32
-- PHP Version: 5.4.16
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `test`
--
-- --------------------------------------------------------
--
-- Table structure for table `test_table`
--
CREATE TABLE IF NOT EXISTS `test_table` (
`id` int(11) NOT NULL,
`title` text CHARACTER SET utf8
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `test_table`
--
INSERT INTO `test_table` (`id`, `title`) VALUES
(2, 'یاشیل قطره'),
(3, 'توسعه صنعت ÙØ±Ø¢ÛŒÙ†Ø¯ باختر'),
(4, 'الوند مکش'),
(5, 'نهاده گستر'),
(6, 'پاکان بذر');
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
link to :
![sample query for this problem][2]
**What is the problem: **
By using of
ALTER DATABASE
and
ALTER TABLE
commands. same as
ALTER DATABASE databasename CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
we can convert an entire MySQL database characterset and collation to UTF-8 when text was Not correctly stored but my problem is that: ALTER TABLE tablename CHARACTER SET utf8 only sets the default charset on a table which is used for newly created columns. And it does not convert existing columns that already have a char set. how do it only by MySQL Commands and without exporting to file
pay attention: This problem started when the character settings (character set ) in the server settings were not set correctly to utf8 and remained unchanged on latin1, which is mysql by default setting.
Edit: add source sql insted linking to it