MySQL database of english words? MySQL database of english words? php php

MySQL database of english words?


Most Unix systems have a set of word lists, in my Ubuntu system it is on /usr/share/dict/american-english

A single word comes per line, so it's easy to insert if you really want it in a database.

This bash oneliner does it inefficiently:

cat /usr/share/dict/american-english \    | while read i; do echo insert into wordlist\(word\)  VALUES \(\"$i\"\); done \    | mysql -u<user> -p<pass> <db>

This MySQL command does it efficiently (if the file is in the same machine):

LOAD DATA LOCAL INFILE '/usr/share/dict/american-english' INTO TABLE wordlist;


For importing a word list to MySQL, use

LOAD DATA LOCAL INFILE '/usr/share/dict/words' INTO TABLE words;

where words is a single-column table.