LifeDesign Learning Zone
IndieWeb community members that use MySQL as some primary storage on their personal site:
Regarding database-antipattern: By and large, I have not experienced the downsides documented there. It did take me some time to correctly migrate my database from latin1 encoding to UTF-8 (character encoding is hard, yo), but I did not find that process prohibitive to continuing to use MySQL. gregorlove.com's content has resided safely in MySQL since 2002.
Secondary Data Store
IndieWeb sites that use MySQL to store secondary data, i.e. not content that they authored, but content from elsewhere.
p3k uses MySQL to query posts by different meta data, but does not store any post content in the database.
- 1 IndieWeb Examples
- 2 Secondary Data Store
- 3 Caching Examples
- 4 Criticism
- 5 See Also
Lack of timezone in date columns
MySQL date columns can only store
YYYY-mm-dd HH:MM:SSprecision. There is no way to specify the timezone along with a date. This means unless you create a second column to store the timezone offset or name, you will have no indication of the timezone of your date in the database.
DATE, DATETIME, and TIMESTAMP types
DATETIMEtypes do not store timezone values. It is recommended to use the
TIMESTAMPtype for maximum flexibility, because these values are converted to UTC before storage, and converted from UTC to the current timezone on retrieval.
MySQL converts TIMESTAMP values from the current time zone to UTC for storage, and back from UTC to the current time zone for retrieval. (This does not occur for other types such as DATETIME.) By default, the current time zone for each connection is the server's time. The time zone can be set on a per-connection basis. As long as the time zone setting remains constant, you get back the same value you store. If you store a TIMESTAMP value, and then change the time zone and retrieve the value, the retrieved value is different from the value you stored. This occurs because the same time zone was not used for conversion in both directions. The current time zone is available as the value of the
Fulltext Search ignores words shorter than 4 characters
This restriction  makes searches for TLAs not possible using fulltext searching. If the length of the entire query is less than 4 characters the fulltext search can be replaced with a case-insensitive
LIKEmatch, but this still lessens the accuracy of queries longer than 4 characters with significant terms shorter as they will be ignored.
MySQL has a default list of stopwords that will not be used in full-text searches. This can and has caused problems with the IndieWebCamp wiki search when searching for simple words.
How to disable stopwords
Stopwords can be disabled in a MySQL server by doing the following:
- Add the following to your
/etc/my.cnffile (or wherever that file is)ft_stopword_file = "" ft_min_word_len=3
- Restart mysql. Usually something like
sudo service mysqld restart
- Rebuild the index for any tables you are searching. In the case of MediaWiki, this is the "searchindex" table:
mysql -u root -e 'REPAIR TABLE searchindex QUICK;'
Lacks Full UTF-8 Support
utf8character encoding only partially implements UTF-8. It can only store one- to three-byte characters and cannot store four-byte characters. Instead, the
utf8mb4encoding (available since MySQL 5.5.3) should be used. See How to support full Unicode in MySQL databases for more information.
Unhappy with non-ASCII input
unfortunately mysql doesn't seem to happy with my kanji input
- Ben Roberts (2014-10-16)
fwiw I had a similar MySQL encoding problem and it barfed on a emdash! luckily only 1 entry needed to be re entered. [...] it refused the emdash as an entry in the DB because it could not be encoded in latin whatever
- Kartik Prabhu (2014-10-16)