在 MySQL 数据库中以阿拉伯语保存数据

Save Data in Arabic in MySQL database(在 MySQL 数据库中以阿拉伯语保存数据)
本文介绍了在 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 .

只是享受....

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

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)