# MySQL error while precompling

**URL:** <https://discourse.julialang.org/t/mysql-error-while-precompling/885>\
**Category:** Data\
**Tags:** mysql\
**Created:** [December 12, 2016, 11:04am UTC](https://discourse.julialang.org/t/mysql-error-while-precompling/885 "2016-12-12T11:04:36Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [December 12, 2016, 11:04am UTC](https://discourse.julialang.org/t/mysql-error-while-precompling/885/1 "2016-12-12T11:04:36Z")

</div>

Hi all-

I am using Julia .5 on Ubuntu 16.04. When I try to use MySQL I get the following message. Is there something else I need to configure?

Thanks,

Chris

```julia
ERROR: LoadError: LoadError: MYSQL library not found
 in macro expansion; at /home/dfish/.julia/v0.5/MySQL/src/config.jl:25 [inlined]
 in anonymous at ./<missing>:?
 in include_from_node1(::String) at ./loading.jl:488 (repeats 2 times)
 in macro expansion; at ./none:2 [inlined]
 in anonymous at ./<missing>:?
 in eval(::Module, ::Any) at ./boot.jl:234
 in process_options(::Base.JLOptions) at ./client.jl:239
 in _start() at ./client.jl:318
while loading /home/dfish/.julia/v0.5/MySQL/src/config.jl, in expression starting on line 8
while loading /home/dfish/.julia/v0.5/MySQL/src/MySQL.jl, in expression starting on line 8

```

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [December 12, 2016, 1:09pm UTC](https://discourse.julialang.org/t/mysql-error-while-precompling/885/2 "2016-12-12T13:09:16Z")

</div>

You most likely need to install missing MySQL packages, [as stated here](https://github.com/JuliaDB/MySQL.jl#installation). Though ideally the package would do this automatically for you.

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [December 12, 2016, 5:02pm UTC](https://discourse.julialang.org/t/mysql-error-while-precompling/885/3 "2016-12-12T17:02:26Z")

</div>

Thanks. I did install MySQL but using a different set of instructions. So its possible I did not install it properly.

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [December 14, 2016, 9:24am UTC](https://discourse.julialang.org/t/mysql-error-while-precompling/885/4 "2016-12-14T09:24:43Z")

</div>

MySQL is installed properly as far as I can tell. The MySQL Julia page suggests manually configuring the config.jl file by inserting the path to the MySQL.so file. I could not find that anywhere on my computer and searching on google was not very helpful unfortunately. Does any one know where I can find this file?

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [December 14, 2016, 9:50am UTC](https://discourse.julialang.org/t/mysql-error-while-precompling/885/5 "2016-12-14T09:50:44Z")

</div>

Looks like it is (or must be created) in `~/.julia/MySQL/src/`. The [docs about this](https://github.com/JuliaDB/MySQL.jl#how-to-solve-mysql-library-not-found-error) could probably be made more explicit.

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [December 14, 2016, 10:18am UTC](https://discourse.julialang.org/t/mysql-error-while-precompling/885/6 "2016-12-14T10:18:42Z")

</div>

Thanks. I agree that it was a little confusing because there are several config.jl files within Julia. However, I did find the correct config.jl file within the MySQL julia package. The problem I have encountered is adding the path of the MySQL.so file to the following code in the config.jl file:

> @static is\_linux() ? (lib\_choices = [“libmysql.so”, “libmysqlclient.so”,  
> “libmysqlclient\_r.so”, “libmariadb.so”,  
> “libmysqlclient\_r.so.16”]) : nothing  
> @static is\_apple() ? (lib\_choices = [“libmysqlclient.dylib”]) : nothing  
> @static is\_windows() ? (lib\_choices = [“libmysql.dll”, “libmariadb.dll”]) : nothing

My understanding is that I need to add the full path to one of the file names in lib\_choices, such as “libmysql.so” and also add a path to LD\_LIBRARY\_PATH . However, I cannot find any of those files on my system. Or am I just interpreting the instructions wrong? (my appologies for being dense. I’ve never had to deal with this aspect of MySQL)

Hopefully, one of the developers will automate this process. Its a bit cumbersome.

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [December 14, 2016, 10:44am UTC](https://discourse.julialang.org/t/mysql-error-while-precompling/885/7 "2016-12-14T10:44:03Z")

</div>

According to [packages.ubuntu.com](http://packages.ubuntu.com), the `libmysqlclient20` package provides `/usr/lib/x86_64-linux-gnu/libmysqlclient.so.20`, and the `libmariadb2` provides `/usr/lib/x86_64-linux-gnu/libmariadb.so.2` (if you are on 64-bit). You can also install the corresponding `*-dev` packages, and the default names should work.

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [December 14, 2016, 10:54am UTC](https://discourse.julialang.org/t/mysql-error-while-precompling/885/8 "2016-12-14T10:54:20Z")

</div>

Thanks for the lead. I’ll look into this and document what I find.

---

<div class="post-metadata">

**Author:** ![krudutta](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@krudutta](https://discourse.julialang.org/u/krudutta)\
**Post date:** [April 15, 2017, 2:18pm UTC](https://discourse.julialang.org/t/mysql-error-while-precompling/885/9 "2017-04-15T14:18:06Z")

</div>

I have been facing the same issue and couldn’t figure out what to do. Could you please help me out here? [Here](https://github.com/JuliaDB/MySQL.jl#how-to-solve-mysql-library-not-found-error) it says the location is something like: `/usr/local/lib/mysqldb/` but there’s no such directory.

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [April 15, 2017, 2:44pm UTC](https://discourse.julialang.org/t/mysql-error-while-precompling/885/10 "2017-04-15T14:44:27Z")

</div>

@krudutta, unfortunately I was not able to get it to work on my system. I’m not very familiar with MySQL, so I probably won’t be very helpful. @nalimilan, may have some ideas.

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [April 15, 2017, 2:56pm UTC](https://discourse.julialang.org/t/mysql-error-while-precompling/885/11 "2017-04-15T14:56:57Z")

</div>

What distribution are you using?
