在 MySQL 数据库中以阿拉伯语保存数据
我更改了表格和列的字符集,我得到的阿拉伯文本为????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 .
只是享受....
相关文章