Compiling GDAL on Ubuntu Linux with SQLite and MySQL support

Fist install MySQL client libraries and check their location:

apt-get install libmysqlclient-dev
find / -name '*libmysqlclient*'

Then install SQLite:

sudo apt-get install sqlite3 libsqlite3-dev

Extract GDAL sources and configure supported modules (MySQL and SQLite are not compiled by default, so we need to specify them explicitly):

cd gdal-2.1.1/
./configure --with-sqlite3 --with-mysql

this will output “MySQL support: yes” and “SQLite support: yes” along with other information.

Make GDAL and built executables to PATH:

export PATH=$PATH:/home/dmitriano/work/gdal-2.1.1/apps

The following command

ogrinfo --formats

shows “SQLite -vector- (rw+v): SQLite / Spatialite” and “MySQL -vector- (rw+): MySQL” along with other formats.

The alternate way to get GDAL binaries is to install them from the repository:

apt-get install gdal-bin

Leave a Reply

Your email address will not be published. Required fields are marked *