Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enter the Indian Rupee symbol in MySQL Server 5.1?

I am unable to find the exact solution for MySQL

like image 911
Ramaraja Ramanujan Avatar asked Dec 02 '22 13:12

Ramaraja Ramanujan


1 Answers

The thing is the column supports by default UTF-8 encoding which consists of 3 bytes. The Indian Rupee Symbol, since it is new has a 4 byte encoding. So we have to change the character encoding to utf8_general_ci by,

ALTER TABLE test_tb MODIFY COLUMN col VARCHAR(255)
    CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

After executing the above query simply execute the following query to insert the symbol,

insert into test_tb values("₹");

Ta-Da!!!

like image 135
Ajit Singh Avatar answered Dec 05 '22 10:12

Ajit Singh