問題描述
我更改了表格和列的字符集,我得到的阿拉伯文本為????MYSQL 數據庫中的標記
I have changed the charset of the tables and of the column, i get the arabic text as ???? marks in MYSQL database
這是桌子的設計
CREATE DATABASE mydb
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;
CREATE TABLE `categories` (
`category_id` tinyint(2) NOT NULL auto_increment,
`category_name` varchar(50)character set utf8 NOT NULL ,
PRIMARY KEY (`category_id`)
insert into `mydb`.`categories`
(`category_id`, `category_name`)
values (1,'??????');
commit;
當我再次觸發選擇查詢時,它顯示 ????作為文本?
When I again fire select query it shows ???? as text?
誰能告訴我我哪里做錯了?
Can anyone tell me where am i doing wrong?
推薦答案
手動將阿拉伯語數據插入您的 Phpmyadmin.
To insert Arabic Data manually into your Phpmyadmin.
首先檢查您的數據庫、表和列名稱是否設置為 utf8.如果這些沒有設置為 utf8 那么首先你設置它然后你可以將阿拉伯語數據插入到你的數據庫表中.
First you check either your database , table and column name is utf8 set or not. If these are not set to utf8 then first you set it then you may insert arabic data into you db table.
對于數據庫:
SELECT default_character_set_name FROM information_schema.SCHEMATA S
WHERE schema_name = "schemaname";
對于表格:
SELECT CCSA.character_set_name FROM information_schema.`TABLES` T,
information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA
WHERE CCSA.collation_name = T.table_collation
AND T.table_schema = "schemaname"
AND T.table_name = "tablename";
對于列:
SELECT character_set_name FROM information_schema.`COLUMNS` C
WHERE table_schema = "schemaname"
AND table_name = "tablename"
AND column_name = "columnname";
如果您使用 SQLYog,您可以輕松地將 utf8 設置為您的表.
You may easily set utf8 to your tables if you are using SQLYog.
只需右鍵單擊db、表、列名并單擊alter選項并設置為
Just right click on db, table, column name and click on alter option and set to
數據庫圖表集 = utf8數據庫整理 = utf8_general_ci .
Database Chartset = utf8 Database Collation = utf8_general_ci .
只是享受....
這篇關于在 MySQL 數據庫中以阿拉伯語保存數據的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!