在MySQL数据库中以阿拉伯语保存数据 [英] Save Data in Arabic in MySQL database

查看:1643
本文介绍了在MySQL数据库中以阿拉伯语保存数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我改变了表和列的字符集,我得到阿拉伯语文本为???? MYSQL数据库中的标记



这里是表的设计

  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`)


插入`mydb`.`categories`
(`category_id`,`category_name`)
(1,'کتگوری');
commit;

显示????为文本?



任何人都可以告诉我我在哪里做错了?

解决



首先检查你的数据库,表和列名是否设置为utf8。
如果这些没有设置为utf8,那么首先你设置它,然后你可以插入阿拉伯数据到你的db表。



你可以通过下面的查看每个这些示例。



对于数据库:

  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.collat​​ion_name = T.table_collat​​ion
和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设置为表。



只需右键单击db,表格,列名称,然后点击alter选项并设置为



数据库Chartset = utf8
数据库Collat​​ion = utf8_general_ci。



只是享受....


I have changed the charset of the tables and of the column, i get the arabic text as ???? marks in MYSQL database

here is the design of the table

  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?

解决方案

To insert Arabic Data manually into your Phpmyadmin.

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.

YOU MAY CHECK EACH OF THESE BY LOOKING BELOW EXAMPLE.

For Database:

SELECT default_character_set_name FROM information_schema.SCHEMATA S
WHERE schema_name = "schemaname";

For Tables:

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";

For Columns:

SELECT character_set_name FROM information_schema.`COLUMNS` C
WHERE table_schema = "schemaname"
  AND table_name = "tablename"
  AND column_name = "columnname";

You may easily set utf8 to your tables if you are using SQLYog.

Just right click on db, table, column name and click on alter option and set to

Database Chartset = utf8 Database Collation = utf8_general_ci .

Just Enjoy ....

这篇关于在MySQL数据库中以阿拉伯语保存数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆