Instructions

This site does not have a searchable interface to the Bible or Koran. There's plenty of sites out there which do. No, this site has files which enable you to swiftly load the Koran and/or Bible into your own MySQL database. And because the files are plain text, it wouldn't take a lot of fiddling to get them to load on any database system.

You'll need to have access to a working MySQL client/server setup, with the create database privelege. You can download MySQL for free from the official MySQL site at http://dev.mysql.com/downloads/mysql/5.0.html#downloads .

Creating the Bible SQL database

Download either bible.mysql.gz or bible.mysql.txt from this site's Download page. Linux / Mac users will probably want the former, Windows users the latter.

  1. If you have the .gz file, unzip it at the command line with
    gunzip bible.mysql.gz
    

    Your 3M zipped file should expand into an 11M file called bible.mysql.

  2. Feed the bible database dump file through your mysql client program.

    mysql < bible.mysql

    You'll notice I've left out the hostname, user and pass arguments. Like many people, I've set up a .my.cnf file in my home directory so I don't need to type them over and over again. But if you do, the syntax is

    mysql -h hostname -u username -pxxxx < bible.mysql

    Or, if you started with the plain text file the command will be
    mysql < bible.mysql.txt

    The dumpfile will create the database for you, if it doesn't already exist. It takes about 7 secs to create on my box, and my hardware is not particularly souped up. The database tables under the mysql data directory take up approx 20M of disk space. You can of course delete the dump file after creating the database to free up some space.

  3. Presto! You have a new database called bible. Open your mysql client program with

    mysql -u username -h hostname -pxxxxx bible

    Check that you have all four tables:

    mysql> show tables from bible;
    +-----------------+
    | Tables_in_bible |
    +-----------------+
    | apoc            |
    | bible           |
    | bible_basic     |
    | books           |
    +-----------------+
    

    The King James Version is contained in the bible table, the Basic English bible is in the bible_basic table, the Apocrypha is in the apoc table, and the books table contains mappings of book abbreviations to book names. It also says which testament a book belongs to.

    Do a desc tablename on any table to see the structure. They're all pretty simple.

  4. The Koran Database

    Pretty much as above except instead of bible.mysql.txt, you'll be using koran.mysql.txt. The koran file creates another database called, unsurprisingly, koran.

    That's it. Now get playing with some queries.

    Problems

    With a brand new MySQL installation, it might bomb out with an error

    ERROR 1044 (42000) at line 18: Access denied for user 'richselby'@'localhost' to database 'bible'
    

    This means that your mysql user doesn't have permission to use the bible database which it has just created. The solution to this is to run mysql preferably as root or any user with a high degree of privilege, and run the command

    CREATE DATABASE bible;
    GRANT ALL ON bible.* TO 'richselby'@localhost;
    

    Obviously, stick your own username and host in the command, not mine.

Comments

Thank You!

Thank you for all of your efforts.
It's great to the Bible in MySQL.
chris

Thank you

Again thank you for this. If you get a #2 error message, it means that MySQL can't find the file (had to search for that one too).

Thanks,
Lance

This worked for me

I had to do this.

mysql> SOURCE C:/[or_path_to_your_file]/bible.mysql.txt
or mysql> \. C:/[or_path_to_your_file]/bible.mysql.txt

The gzipped version was to big to install directly into the Database from PHP MyAdmin so the console is necessary.

Thanks,
Lance

MS Sql Server

Any chance you could produce a .sql file for your creation method. Don't have or use mysql.

thanks for your help.

-- Just download the files and give them a try. MySQL specific syntax is wrapped in special comments /*! like so */ which mysql recognises and acts on but other databases ignore. You may find you need to edit the files, but I imagine they will be tiny edits. Let us know how you get on! -Ed.

ack... remote server?

THANK YOU for the database!

Works & installs fine here at home... but what about ULing it to my ISP? phpMyAdmin fails (takes a while, y'know!), the INSERTs are long lines so I can't write some kind of VB file-splitter...

Suggestions...?

thanks!

That's a tough one. Anyone else managed to do this via phpMyAdmin running remotely? I have always used the mysql client running locally, or sometimes via ssh on a remote server. You should be to use the mysql client running on your box to connect to your ISP's server - Ed.