Matlab Mysql connect (Windows 7 64bit) steps

Installation Step for Mysql on Matlab ( Windows 7 64 bit)

*Install MATLAB R2010a.

*Download Visual C++ 2008 Express Edition
http://www.microsoft.com/express/downloads/#2008-Visual-CPP
Select Visual Studio 2008 tab
Select Visual C++ 2008 Express Edition select language and download it
While downloading it will ask for to browse a file , select the option NO (which say download and install automatically)

*Download Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP
http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&displaylang=en
click on download and click download again on the next page
While installing you will come across
Installation Options
On that page see that all the check boxs in Developer tool in that Windows header and libraries are selected.

*Open Matlab and type
>> mex -setup
Would you like mex to locate installed compilers [y]/n? n
You will get few compiler options

Press the appropriate number corresponding to the name ” Microsoft Visual C++ 2008 Express”

You may get this reply , if so enter “y”
“Your machine has a Microsoft Visual C++ 2008 Express compiler located at
C:\Program Files (x86)\Microsoft Visual Studio 9.0. Do you want to use this compiler [y]/n? y

You may get this reply , if so enter “y”
“Please verify your choices:
Compiler: Microsoft Visual C++ 2008 Express
Location: C:\Program Files (x86)\Microsoft Visual Studio 9.0 “

Are these correct [y]/n? y

You may get some warnings which can be avoided, but see that you get this reply

“Trying to update options file: C:\Users\jchong\AppData\Roaming\MathWorks\MATLAB\R2010a\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2010a\bin\win64\mexopts\msvc90freeopts.bat

Done . . .”

*Download Mysql server
http://dev.mysql.com/downloads/mysql/
In that download the option with name
Windows (x86, 64-bit), ZIP Archive 118.4mb file

When you unzip the folder check for ” include” folder in it (need to be present)

*Download mysql.cpp file
http://www.mathworks.com/matlabcentral/fileexchange/8663-mysql-database-connector

Copy the mysql.cpp file and copy the file and paste it in Matlab current folder panel on left

*Copy the “libmysql.dll” file from “opt” folder of your unzipped mysql (say in “mysql-5.1.49-winx64\lib\opt”) and paste it in system32 folder in C:\windows\system32.
*Copy “libmysql.lib” in the “opt” folder and paste in the matlab current folder panel were we also pasted mysql.cpp file before.
*Once done execute the following command in matlab
>> mex -I”C:\Users\jchong\mysql-noinstall-5.1.49-winx64\mysql-5.1.49-winx64\include” -DWIN32 mysql.cpp libmysql.lib
Note that we should give absolute path of the include file to it.
*To check for success try some matlab commands
>> mysql(‘status’)
Not connected
>> mysql
No connections open
If you get the above response you have successfully compiled mysql.cpp file

Advertisements

11 Comments (+add yours?)

  1. Eyelet Curtains ·
    Nov 04, 2010 @ 06:49:59

    sometimes windows7 won’t install if you install it on a pc with a previous installation of windows XP ‘

    Reply

    • ali
      Mar 21, 2011 @ 15:18:15

      thank you very much!!! if you are still reading this, you saved my day!! it took me almost a day to figure out everything but it worked… i am using mysql for the first time but finally i am connected to the database.. i really appreciate your efforts!! thanks again..

      Reply

      • akku87
        Jan 06, 2012 @ 02:31:37

        @Ali its my pleasure 🙂

  2. Kevin
    Jan 01, 2012 @ 14:34:18

    Hello
    Did you compile mysql.cpp on Matlab 64-bit or 32-bit? I have tried to compile this file one 32-bit Matlab. But it failed. I have no idea what happened.

    Reply

    • Kevin
      Jan 01, 2012 @ 14:43:11

      Now, followed your guide, I have successfully compiled mysql.cpp on 64-bit Matlab (windows 7 64). Many thanks for your information.

      Reply

      • akku87
        Jan 06, 2012 @ 02:33:17

        @Kevin, glad I was helpful.

  3. Norman Guinasso
    Jan 10, 2012 @ 16:45:12

    Thank you very much. Following your directions I was able to install mysql in the following environment.
    Windows 7 64bit
    Visual C++ 2010
    SDK 7.1
    MYSQL Server 5.5

    Reply

  4. Gilles Clermont
    Apr 25, 2012 @ 01:17:47

    Same as Norman above.
    Copying the libmysql.dll to system32 folder was the key.

    Thank you very much.

    Reply

  5. akku87
    Apr 25, 2012 @ 02:39:00

    I am glad that was helpful. Thanks for the reply.

    Reply

  6. smsravanth
    May 17, 2012 @ 02:41:37

    Hi I did the same thing but it says mysql.cpp was not found

    Reply

  7. http://humdrumscenery834.xanga.com/773569399/what-is-the-dependence-on-little-company-it-support
    Jun 04, 2013 @ 00:06:00

    Definitely believe that which you stated.
    Your favorite justification seemed to be on the internet the simplest thing to be aware
    of. I say to you, I certainly get annoyed while people consider worries that they plainly don’t know about. You managed to hit the nail upon the top and defined out the whole thing without having side effect , people can take a signal. Will likely be back to get more. Thanks

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: