Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What MySQL datatype & attributes should be used to store large amounts of html formatted data?

Tags:

types

sql

mysql

I'm setting up a database using PHPMyAdmin and many fields will be large chunks of HTML.

What MySQL datatype & attributes should be used for fields that store large amounts of HTML data?

like image 950
edt Avatar asked Nov 21 '25 02:11

edt


2 Answers

TEXT, MEDIUMTEXT, or LONGTEXT

like image 162
Trevor Avatar answered Nov 22 '25 16:11

Trevor


I would recommend against storing large chunks of HTML (or other text data) in a database. I find that it's often far more useful to store files as files, and put a filename in the database instead.

On the other hand, if you're doing everything through phpMyAdmin, you may not have that option available to you.

like image 39
friedo Avatar answered Nov 22 '25 15:11

friedo