/mysql_static_msvc

Static Library for Microsoft Visual Studio

mysql_static_msvc

Static Library for Microsoft Visual Studio

  1. Goto https://downloads.mysql.com/archives/community/ and Download Desire Version. Sample is Version 5.7.28

image

  1. For build from source, you must need openssl static build so you can download from https://www.openssl.org/source/. You can use any desire version. In sample choose 1.1.1l

image

  1. Need to build openssl, so follow https://github.com/RayMarmAung/openssl-1.1.1k_vs_static
  2. Extract mysql-5.7.28 to desired directory. For example C:\sql\mysql-5.7.28

image

  1. Need CMake, download from https://cmake.org/download/ , install and set environment path to this
  2. Launch Developer Command Prompt for VS 2017 as admin, you can use any VS version
  3. Change to mysql src directory

image

  1. Type CMake command like this

cmake -Bc:\mysql -DBUILD_SHARED_LIBS=OFF -DLINK_STATIC_RUNTIME_LIBRARIES=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST="C:\Boost" -DWITH_SSL="C:\openssl32_msvc" -G "Visual Studio 15 2017"

-B is build path, -DWITH_SSL is your previous built openssl path, -G is compilar, if need 64 bit, type "Visual Studio 15 2017 Win64" And wait a while to finish

image

  1. After finished, goto cmake build path and find MySQL.sln (for example- c:\mysql\MySQL.sln). and open it with visual studio
  2. Then Build ALL_BUILD with RelWithDebInfo

image

  1. After finish, you will find mysqlclient.lib in cmake build in archive_output_directory\RelWithDebInfo directory

image

P.S - this library links with these standard libs

  • advapi32
  • user32
  • crypt32
  • gdi32

These libraries are necessary to declare when you build Qt Static Build