Posts Tagged ‘MySQL Windows’

Setting the TZ Environment Variable for MySQL on Windows

Monday, June 24th, 2013

Most of us are familiar with how MySQL handles timezones, and what one must do to keep up with the latest changes, etc. Most of us use the system timezone info, which is great – one less item to update when changes occur (usually because of daylight savings changes). And for those who need more specifics, most everyone (except Windows and HP-UX) can update their timezone info using the zoneinfo database from the OS.

For those few Windows and HP-UX, you have to download the package of pre-built time zone tables that MySQL provides. Per the manual (timezone section):

“If your system is one that has no zoneinfo database (for example, Windows or HP-UX), you can use the package of pre-built time zone tables that is available for download at the MySQL Developer Zone:”

http://dev.mysql.com/downloads/timezones.html

So the questions becomes, is that your only option on Windows?

The answer is “no”.

At the top of the same manual page, it says:

“You can also set it by setting the TZ environment variable before you start mysqld. The permissible values for –timezone or TZ are system dependent. Consult your operating system documentation to see what values are acceptable.”

Now, it doesn’t tell you what these are since they are OS-dependant. Also, I couldn’t easily find any mentions of what the proper settings for Windows are for MySQL, but in the end, and after a good bit of testing various values (especially around DST times), I found what works (at least in the U.S. for now).

Of course, first, you must create an “environment variable” named TZ, unless you already have one, but that is doubtful (at least it is not default in my experience). If you are not familiar with how to create an environment variable, perhaps you should not do this for your first attempt, as I don’t want you to mess up your system. But for those who would still like to know:

Control Panel ->  System -> Advanced System Settings -> Environment Variables
  -> Click "New" *under* "System variables"

You’ll want to give the “System variable” the name: TZ

And then ‘some’ of the permissible values are:

EST5EDT
CST6CDT
MST7MDT
PST8PDT

I had only tested these in the U.S., so you’ll have to perform further tests if you wish to use other values. If you do use others, be sure to test them thoroughly, especially around your respective DST changeovers.

Fwiw, I did post the above tip in the “User Comments” on the manual page, but wanted to share the info here, in case to make it a bit easier to find.

Now why would any of this be useful?

Well, no values for TZ on Windows have been documented, nor tested, so at least this helps with that.

And as for practical uses, this would allow your MySQL to use the “system”, but it could still differ from the “system”. That is, your server could be in Pacific time zone, and you want the server system to remain PST, but you want MySQL to be Eastern (EST) for whatever reason. This would allow you to accomplish that without having to load the MySQL timezone tables (and then keep them up-to-date when changes occur).

Note that if you do set TZ to “EST5EDT”, after re-starting MySQL, you will see (it only shows “EDT”):

mysql> show global variables like '%zone%';
+------------------+--------+
| Variable_name    | Value  |
+------------------+--------+
| system_time_zone | EDT    |
| time_zone        | SYSTEM |
+------------------+--------+

This is normal, and expected, and the same occurs for EST5EDT, CST5CDT, MST5MDT, and PST5PDT.

Hope this helps. :)

 
 

Dealing with the dreaded “The printer is out of paper” or ERROR_OUT_OF_PAPER Error on Windows ;)

Wednesday, March 20th, 2013

Caution: This is just a fun post. :D

I was performing some testing on Windows the other day and encountered the following error in the error log:

130313  9:40:03 [ERROR] Error writing file 'G:\mysql\log.txt' (errno: 28)

Quickly, I ran “perror 28″ from the command line:

c:\>perror 28
Win32 error code 28: The printer is out of paper.

Hehe, really, Windows?!?

In fact, the drive was out of space. No more could be written to the general log, hence the error.

Fwiw, the Linux OS code 28 reports what you would expect:

OS error code  28:  No space left on device

So, if you ever run into “The printer is out of paper” error, you’ll know what to do. ;)

 

MariaDB 5.5 is now GA

Tuesday, April 17th, 2012

Well, as you or may not have heard, MariaDB 5.5 (5.5.23) was declared GA last week!

It was only about 6-ish weeks ago that MariaDB 5.5 had been released as alpha, so the fact it’s already GA is excellent news for all MariaDB users (and MySQL 5.5 users looking to migrate).

Some of the 5.5 enhancements include:

  • Significantly more efficient thread pool, comparable in functionality to the closed source feature in MySQL Enterprise.
  • Non-blocking client API Library (MWL#192)
  • @@skip_replication option (MWL#234)
  • SphinxSE updated to version 2.0.4.
  • “extended keys” support for XtraDB and InnoDB
  • New INSTALL SONAME statement
  • New LIMIT ROWS EXAMINED optimization.
  • mysql_real_connect() Changes
    In MySQL, and in MariaDB versions before 5.5.21, mysql_real_connect() removes from the MYSQL object any options set with mysql_option() when it fails. Beginning with MariaDB 5.5.21, options are preserved by a failing mysql_real_connect(); use mysql_close(), as normal, to clear them.
    This only has effect if the MYSQL object is reused after a mysql_real_connect() failure (which is unusual). No real-life incompatibilities are expected from this change (it is unlikely that an application would rely on options being automatically removed between connection attempts).

  • The variables replicate_do_*, replicate_ignore_*, and replicate_wild_* have been made dynamic, so they can be changed without requiring a server restart. See Dynamic Replication Variables for more information.
  • Updates to performance schema tables are not stored in binary log and thus not replicated to slaves. This is to ensure that monitoring of the master will not cause a slower performance on all slaves. This also fixes a crash on the slaves.

Here is the official “What is MariaDB 5.5″ page:

http://kb.askmonty.org/en/what-is-mariadb-55

Also of interest:

Release Notes
Changelog
General Info

And as always, if you’d like full support for MariaDB, just contact us at SkySQL.

Hope this helps.

 

Building MariaDB 5.3 on Windows

Friday, February 10th, 2012

I just wanted to share my steps for building MariaDB 5.3 on Windows. (Note, this is not much different than the instructions Wlad posted here).

But, things are not always so smooth, and of course I ran into a couple small issues, so I wanted to share my outputs plus those issues and their solutions (once again many thanks go to Wlad!) for those out there who might encounter the same.

Here are the steps to build:

  1. Download MariaDB 5.3 and extracted to C:\mariadb-5.3
  2. cd C:\mariadb-5.3
  3. mkdir bld
  4. cd bld
  5. cmake .. -G "Visual Studio 9 2008"
  6. cmake --build . --config relwithdebinfo --target package

* By making a sub-dir named ‘bld’ and cd’ing into it, you’ll keep all of your build files in their own dir. This way, it is easy to start over (just delete /bld/) and it also keeps your sourcedir clean and looking like it does originally.

** The last command is the build command issued from the command line. You could accomplish the same with the following commands from within Visual Studio:

VS2008: File -> Open -> Solution -> C:\mariadb-5.3\bld\MySql.sln
VS2008: Build -> Build Solution
VS2008: Right-click "PACKAGE" -> Build

..

Outputs:

C:\Users\Chris>cd C:\mariadb-5.3

C:\mariadb-5.3>mkdir bld

C:\mariadb-5.3>cd bld

C:\mariadb-5.3\bld>cmake ..
-- Building for: Visual Studio 8 2005
-- Check for working C compiler using: Visual Studio 8 2005
-- Check for working C compiler using: Visual Studio 8 2005 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 8 2005
-- Check for working CXX compiler using: Visual Studio 8 2005 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - not found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void *
-- Check size of void * - done
-- Using Aria for temporary tables
build ARCHIVE as static library (libarchive.lib)
build BLACKHOLE as static library (libblackhole.lib)
build CSV as static library (libcsv.lib)
build FEDERATEDX as static library (libfederatedx.lib)
build HEAP as static library (libheap_s.lib)
build ARIA as static library (libaria_s.lib)
build MYISAM as static library (libmyisam_s.lib)
build MYISAMMRG as static library (libmyisammrg_s.lib)
build PBXT as static library (libpbxt_s.lib)
build XTRADB as static library (libxtradb.lib)
build FEEDBACK as static library (libfeedback.lib)
build EXAMPLE as DLL (ha_example.dll)
build FEDERATED as DLL (ha_federated.dll)
build INNODB_PLUGIN as DLL (ha_innodb_plugin.dll)
-- Could NOT find Boost
-- Performing Test BOOST_OK
-- Performing Test BOOST_OK - Failed
build SPHINX as DLL (ha_sphinx.dll)
-- Looking for MFC
-- Looking for MFC - found
-- Cannot find wix 3, installer project will not be generated
-- Configuring done
-- Generating done
-- Build files have been written to: C:/mariadb-5.3/bld

I first compiled from within Visual Studio (alternate step #6), and here is the last line of that output:

========== Build: 84 succeeded, 1 failed, 2 up-to-date, 6 skipped ==========

(More on the 1 error below – but it’s safe to ignore.)

And here is the output from the command line compilation (since I did this second, there was not nearly the output, so I ‘ll post it all):

C:\mariadb-5.3\bld>cmake --build . --config relwithdebinfo --target package

Microsoft (R) Visual C++ Express Edition Version 9.0.30729.1.
Copyright (C) Microsoft Corp 2007. All rights reserved.
1>------ Build started: Project: PACKAGE, Configuration: RelWithDebInfo Win32 ------
1>
1>Performing Post-Build Event...
1>CPack: Create package using ZIP
1>CPack: Install projects
1>CPack: - Install project: MySql
1>CPack: Create package
1>CPack: - package: C:/mariadb-5.3/bld/mariadb-5.3.3-win32.zip generated.
1>Build log was saved at "file://c:\mariadb-5.3\bld\PACKAGE.dir\RelWithDebInfo\BuildLog.htm"
1>PACKAGE - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 86 up-to-date, 0 skipped ==========

..

Error Appendix:

CMake – Cannot find source file “cmake_dummy.cc”:

cmake ..
...
Cannot find source file "cmake_dummy.cc"

Solution:

Upgrading CMake from 2.6 (2.6.4) to 2.8 (2.8.7) worked and eliminated this error. You can download it from here.

..

CMake – General Comment:

If you have previously installed Visual Studio 2005 and now have installed Visual Studio 2008 (or 2008 and 2010, or some other mix), it is probably best to specify the Generator when invoking cmake. I was getting various strange errors when I did not specify the generator of the Visual Studio I use to compile. Specifically, my cmake was using the VS2005 generator, but I was building with VS2008. So, I had to perform a conversion when opening the solution in VS, not to mention some other starange issues were occurring (saying I passed MFC test, but I was using VS2008 Express, so I did not have the proper MFC for VS2008). Similarly, cmake using relwithdebinfo failed too.

Solution:

Instead of using:

cmake ..

Use:

cmake .. -G "Visual Studio 9 2008"

If you’re not sure what string to use for -G, simply run “cmake” from the command line, with no arguments, and it will display the various available options. For instance:

C:\>cmake
cmake version 2.8.7
...
Generators
The following generators are available on this platform:
  Visual Studio 10            = Generates Visual Studio 10 project files.
  Visual Studio 11            = Generates Visual Studio 11 project files.
  Visual Studio 8 2005        = Generates Visual Studio .NET 2005 project
  Visual Studio 9 2008        = Generates Visual Studio 9 2008 project files.

..

Build – afxwin.h missing error – mysql_upgrade_wizard error:

VS2008 Build ..
...
11>Build log was saved at "file://c:\mariadb-5.3\bld\win\upgrade_wizard\
11>mysql_upgrade_wizard.dir\Debug\BuildLog.htm"
11>mysql_upgrade_wizard - 1 error(s), 0 warning(s)
..
c:\mariadb-5.3\win\upgrade_wizard\stdafx.h(23) : fatal error C1083:
Cannot open include file: 'afxwin.h': No such file or directory

Solution:

Since this is just the mysql_upgrade_wizard, this can be ignored unless you specifically need this.

Otherwise, locate ‘afxwin.h’ and store it to the correct location.

Note that you’re likely receiving this if you using the Visual Studio Express Edition, as ‘afxwin.h’ is not available in the Express Edition, as described on the following pages:

http://stackoverflow.com/questions/5543523/afxwin-h-file-is-missing-in-vc-express-edition
http://social.msdn.microsoft.com/forums/en-US/Vsexpressvc/thread/7c274008-80eb-42a0-a79b-95f5afbf6528/

..

Other common build errors and their solutions can be found here.

..

Related Build Links:

 

Building MariaDB 5.1 on Windows

Monday, January 23rd, 2012

Recently, I found myself needing MariaDB 5.1.60 for Windows for some testing purposes. Therefore, I needed to build it from source. I ended up using what I’d call a “blend” of the commands listed in this “how-to” and the readme file INSTALL-WIN-SOURCE, so I thought I’d post those steps.

  1. Download 5.1.60 MariaDB source from here.
  2. cd C:\mariadb-5.1
  3. win\configure.js
  4. cmake .
  5. VS: File -> Open -> Solution -> MySql.sln
  6. VS: Build -> Build Solution
  7. VS: Right-click “PACKAGE” -> Build (in “Solution Explorer” View)

That’s it.

Let’s fire it up:

MariaDB> select version();
+----------------------+
| version()            |
+----------------------+
| 5.1.60-MariaDB-debug |
+----------------------+

MariaDB> show global variables like 'innodb_version';
+----------------+-------------+
| Variable_name  | Value       |
+----------------+-------------+
| innodb_version | 1.0.17-13.0 |
+----------------+-------------+

MariaDB> show engines;
+------------+---------+---------------------------...
| Engine     | Support | Comment		   ...
+------------+---------+---------------------------...
| CSV        | YES     | CSV storage engine	   ...
| InnoDB     | DEFAULT | Percona-XtraDB, Supports t...
| PBXT       | YES     | High performance, multi-ve...
| MARIA      | YES     | Crash-safe tables with MyI...
| MyISAM     | YES     | Default engine as of MySQL...
| FEDERATED  | YES     | FederatedX pluggable stora...
| MRG_MYISAM | YES     | Collection of identical My...
| MEMORY     | YES     | Hash based, stored in memo...
+------------+---------+---------------------------...

..

For reference, here are my full outputs:

C:\Users\Chris>cd ..\..\mariadb-5.1

C:\mariadb-5.1>win\configure.js

C:\mariadb-5.1>cmake .
-- Check for working C compiler: cl
-- Check for working C compiler: cl -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: cl
-- Check for working CXX compiler: cl -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
build CSV as static library (libcsv.lib)
build FEDERATEDX as static library (libfederatedx.lib)
build HEAP as static library (libheap_s.lib)
build MARIA as static library (libmaria_s.lib)
build MYISAM as static library (libmyisam_s.lib)
build MYISAMMRG as static library (libmyisammrg_s.lib)
build PBXT as static library (libpbxt_s.lib)
build XTRADB as static library (libxtradb.lib)
build ARCHIVE as DLL (ha_archive.dll)
build BLACKHOLE as DLL (ha_blackhole.dll)
build EXAMPLE as DLL (ha_example.dll)
build FEDERATED as DLL (ha_federated.dll)
build INNODB_PLUGIN as DLL (ha_innodb_plugin.dll)
-- Configuring done
-- Generating done
-- Build files have been written to: C:/mariadb-5.1

Open Visual Studio -> File -> Open -> Project/Solution -> Select C:\mariadb-5.1.60\MySql.sln

Build Solution Output:

========== Build: 79 succeeded, 0 failed, 2 up-to-date, 2 skipped ==========

Package Build Output:

1>------ Build started: Project: PACKAGE, Configuration: Debug Win32 ------
1>
1>Performing Post-Build Event...
1>CPack: Create package using NSIS
1>CPack: Install projects
1>CPack: - Install project: MySql
1>CPack: -   Install component: Unspecified
1>CPack: -   Install component: headers
1>CPack: -   Install component: mysqltest
1>CPack: -   Install component: runtime
1>CPack: -   Install component: scripts
1>CPack: -   Install component: sqlbench
1>CPack: Compress package
1>CPack: Finalize package
1>CPack: Package C:/mariadb-5.1/MariaDB-5.1.60-win32.exe generated.
1>Build log was saved at "file://c:\mariadb-5.1\PACKAGE.dir\Debug\BuildLog.htm"
1>PACKAGE - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 81 up-to-date, 0 skipped ==========

 
 
..

 
 

MySQL 5.5 Windows Build Appendix : Full Outputs and Common Errors from Building MySQL 5.5 on Windows

Friday, January 20th, 2012

The other day, I posted a “how-to” article for building MySQL 5.5 on Windows from the source code tree.

In an attempt to keep the post as brief as possible, I omitted many outputs, as well as a number of common bugs/problems one could encounter, and so I just wanted to follow-up with some of that in this “appendix” of sorts.

This way, folks who run into any issues might find solutions to those problems here.

I’ll start with the outputs first, followed by the common problems.

Outputs (When works as expected):

..

Output from Obtaining Source Code:

C:\Users\Chris>cd C:\

C:\>bzr init-repo --trees mysql-5.5
Shared repository with trees (format: 2a)
Location:
  shared repository: mysql-5.5

C:\>cd mysql-5.5

C:\mysql-5.5>bzr branch lp:mysql-server/5.5 mysql-5.5
Connected (version 2.0, client Twisted)
Authentication (publickey) successful!
Secsh channel 1 opened.
Branched 3674 revision(s).

..

Output from Building/Compiling Source Code:

C:\mysql-5.5>cd mysql-5.5

C:\mysql-5.5\mysql-5.5>cmake . -DBUILD_CONFIG=mysql_release -G "Visual Studio 9 2008"
-- Check for working C compiler: cl
-- Check for working C compiler: cl -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: cl
-- Check for working CXX compiler: cl -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void *
-- Check size of void * - done
-- MySQL 5.5.21
-- Disable authenticode signing for executables
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - not found.
-- Found Threads: TRUE
-- Looking for fedisableexcept
-- Looking for fedisableexcept - not found
-- Check size of time_t
-- Check size of time_t - done
-- Performing Test TIME_T_UNSIGNED
-- Performing Test TIME_T_UNSIGNED - Failed
-- Cannot find wix 3, installer project will not be generated
-- Configuring done
-- Generating done
-- Build files have been written to: C:/mysql-5.5/mysql-5.5

..

Output from VS 2008 Express Build:

1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
1>Checking Build System
1>CMake is re-running because build system is out-of-date.
1>-- MySQL 5.5.21
1>-- Configuring done
1>-- Generating done
1>-- Build files have been written to: C:/mysql-5.5/mysql-5.5
..........................................
...  ...
..........................................
========== Build: 93 succeeded, 0 failed, 5 up-to-date, 10 skipped ==========

..

Output from Testing:

-DBUILD_CONFIG=mysql_release

mysql> select version();
+------------------+
| version()        |
+------------------+
| 5.5.21-debug-log |
+------------------+
mysql> show engines;
+--------------------+---------+-------------------...
| Engine             | Support | Comment	   ...
+--------------------+---------+-------------------...
| FEDERATED          | NO      | Federated MySQL st...
| MRG_MYISAM         | YES     | Collection of iden...
| MyISAM             | YES     | MyISAM storage eng...
| BLACKHOLE          | YES     | /dev/null storage ...
| CSV                | YES     | CSV storage engine...
| MEMORY             | YES     | Hash based, stored...
| ARCHIVE            | YES     | Archive storage en...
| InnoDB             | DEFAULT | Supports transacti...
| PERFORMANCE_SCHEMA | YES     | Performance Schema...
+--------------------+---------+-------------------...

..

Error Section:

..

Error Connecting to Launchpad via Bazaar (bzr):

C:>bzr branch lp:mysql-server/5.5 mysql-5.5

Connected (version 2.0, client Twisted)
Authentication (publickey) failed.
bzr: ERROR: Connection error: Unable to authenticate to SSH host as
  chriscalender@bazaar.launchpad.net
supported auth types: ['publickey']

Solution:

If you encounter the above, then likely you’ve selected the wrong key or it’s not correct. See this page for even further details.

..

CMake Errors:

Signtool.exe Error:

CMake Error at cmake/install_macros.cmake:155 (MESSAGE):
  signtool is not found.  Signing executables not possible
-- Configuring incomplete, errors occurred!

Solution:

In my case, I searched my computer and had a signtool.exe, just not in a location that was in the $PATH, so I added that tool to the $PATH.

..

Stdint.h not found Error:

-- Looking for stdint.h
-- Looking for stdint.h - not found

Solution:

You can download stdint.h from here, and then save it to C:\Program Files\Microsoft Visual Studio 9.0\VC\include\.

Before re-running CMake again, you should delete CMakeCache.txt.

..

CMAKE_HAVE_PTHREAD_H not found Error:

-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - not found.

Solution:

This is a known bug, but harmless on Windows, so you can ignore it.

..

CMake TIME_T_UNSIGNED Failed Error:

-- Performing Test TIME_T_UNSIGNED
-- Performing Test TIME_T_UNSIGNED - Failed

Solution:

This is also a known bug, but it can also be safely ignored.

..

CMakeLists.txt Location Error:

CMake Error: The source directory "C:/build/mysql-5.5" does not appear to contain CMakeLists.txt.

Solution:

You’re in the wrong directory, ‘cd’ to the location where CMakeLists.txt resides.

..

CMake – Cannot find source file “cmake_dummy.cc”:

cmake ..
...
Cannot find source file "cmake_dummy.cc"

Solution:

Upgrading CMake from 2.6 (2.6.4) to 2.8 (2.8.7) worked and eliminated this error. You can download it from here.

..

Build / Compile Errors:

..

Visual Studio 2005 Errors:

If you try to compile MySQL 5.5 with VS 2005, you’ll likely see tons of syntax errors (I won’t post them all here). While you can use VS 2005 for building MySQL 5.1 and MariaDB 5.1, you’ll need to use VS 2008 to build MySQL 5.5.

..

m4: Invalid argument Error:

4>------ Build started: Project: GenServerSource, Configuration: Debug Win32 ------
4>Generating sql_yacc.cc, sql_yacc.h
4>C:\Program Files\GnuWin32\bin\bison.exe: m4: Invalid argument
4>Project : error PRJ0019: A tool returned an error code from "Generating sql_yacc.cc, sql_yacc.h"

Solution:

Installing this to a location with no spaces should help. However, I did that and still had problems. The only way I found to move past this (at least for now) is to copy the file to $BUILD-DIR/sql/ (specifically, in this case, C:\mysql-5.5\mysql-5.5\sql\). After that, and after deleting CMakeCache.txt (in $BUILD/), I could finally move past this error.

I have subsequently resolved this m4 issue fully, so there is no need to copy this file. You can read the full details on that here:

http://www.chriscalender.com/?p=798

..

Building PACKAGE NSIS Error:

1>Performing Post-Build Event...
1>CPack Error: Cannot find NSIS registry value. This is usually caused by NSIS not being installed.
1>Please install NSIS from http://nsis.sourceforge.net
1>CPack Error: Cannot initialize the generator NSIS
1>Project : error PRJ0019: A tool returned an error code from "Performing Post-Build Event..."

Solution:

Installing NSIS (per the instructions) resolved this error.

..

..

Hope this helps :)

 
 

How to Build MySQL 5.5 from Source Code on Windows

Tuesday, January 17th, 2012

Not counting obtaining the source code, and once you have the prerequisites satisfied, [Windows] users can build from source code in 5 easy steps.

Prerequisites – Install & ensure they are in the $PATH:

  1. CMake <-- Download
  2. C++ compiler <-- Visual Studio 2008 Express - Free Download
  3. Bison <-- Download (ensure m4.exe is also included, which it should be)

Optional (but most likely you’ll want):

  1. Perl <-- For Test Suite/Scripts. Strawberry Perl is a great option.
  2. Bazaar <-- If want latest source tree

Tip: Install these in locations where spaces are not in the path. Specifically, watch for the Bison/m4 as there is a known bug with regards to that.

..

Now that that’s out of the way, we can begin. You just need to decide if you want to build from source code you download or from the latest development tree.

This will walk through building from the latest development tree (since the downloaded version requires no extra steps – just grab it from any mirror).

Also, this post assumes you can connect to the Launchpad repository via Bazaar and download the source (i.e., you’ll have to create SSH keys to connect to Launchpad – see this write-up for more details. You might also need Pageant too, if you don’t already have it.)

I. Prerequisite Checks:

C:\>cmake --version
cmake version 2.6-patch 4

C:\>bison --version
bison (GNU Bison) 2.4.1

C:\>m4 --version
m4 (GNU M4) 1.4.13

C:\>perl --version
This is perl 5, version 12, subversion 3

C:\>bzr --version
Bazaar (bzr) 2.4.1

..

II. Obtain Source Code (skip this if you download the source directly from a mirror):

  1. Open Pageant -> Add Key -> Select your SSH Key (for Launchpad)
  2. cd C:\
  3. bzr init-repo –trees mysql-5.5
  4. cd mysql-5.5
  5. bzr branch lp:mysql-server/5.5 mysql-5.5

..

III. Build/Compile Source Code:

  1. cd mysql-5.5
  2. cmake . -DBUILD_CONFIG=mysql_release -G “Visual Studio 9 2008″
  3. Copy m4.exe to $basedir/sql <-- this avoids any m4.exe errors (or fix this permanently if this affects you)
  4. Open Solution in VS: File -> Open -> Project/Solution -> C:\mysql-5.5\mysql-5.5\MySQL.sln
  5. Now build in VS: Build -> Build Solution (or F7)
========== Build: 93 succeeded, 0 failed, 5 up-to-date, 10 skipped ==========

There you have it! (Assuming you have “0 failed”, otherwise, you’ve got some debugging to do.)

..

For those interested, I have full outputs, and common errors (with their solutions) from the entire process here:

MySQL 5.5 Windows Build Appendix : Full Outputs and Common Errors from Building MySQL 5.5 on Windows

..

Build Notes (step #2 above):

The -DBUILD_CONFIG=mysql_release flag uses the same build options used for official releases, which are stored in cmake/build_configurations/mysql_release.cmake.

The simplest you could use is: cmake . -G “Visual Studio 9 2008″

Or you could specify a number of options: cmake . -DMYSQL_SERVER_SUFFIX=-chris -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 -G “Visual Studio 9 2008″

The -G lets know which compiler will be used. In this case, I’m using VS 2008 Express. If you were using VS 2005, it’d be “Visual Studio 8 2005″, but I’m not sure if VS 2005 will even work.

This command should end with something like “– Build files have been written to: C:/…” or you’ll need to debug.

Lastly, the cmake command creates the MySQL.sln file and all .vcproj files.

..

IV. Kicking the tires …

Creating a “package” in Visual Studio is quite simple:

In the “Solution Explorer” view (far right-hand side of page), right-click on “PACKAGE” -> then “Build”.

If you have problems with this, it can be pieced together easily enough:

  1. Make main dir mysql-5.5.xx
  2. Make subdir bin/ - copy in all .exe files (from client/debug, sql/debug, */debug, etc.)*
  3. Make subdir data/ - copy from sql/data/
  4. Make subdir scripts/ – copy from scripts/ (at least all perl, sql, and sh scripts)
  5. Make subdir share/ - copy from sql/share/
  6. Create my.ini

* Notes re: .exe files: mysqld.exe is located in /sql/debug/ and mysql.exe is located in /client/debug/. The remaining .exe files are located in /client/debug/, /sql/debug/, /extra/debug/, /libmysql/debug/, /mysys/debug/, /scripts/debug/, /storage/myisam/debug/, /storage/heap/debug/, and /tests/debug/.

Now start mysqld:

mysql> select version();
+------------------+
| version()        |
+------------------+
| 5.5.21-debug-log |
+------------------+

Of course you should test it a bit more than that, but I’ll leave that to you.
 
 
..

 
 

Strawberry Perl – A Great Perl Option for Windows MySQL Users

Wednesday, January 11th, 2012

A few months ago I wrote an article geared towards MySQL Windows users on using ActiveState Perl in order to run various MySQL scripts. It was kind of a pain to get set up properly for MySQL usage, hence requiring a write-up in the first place. ;)

But now I’d just like to inform all Windows MySQL users that using Strawberry Perl for your Perl needs is much easier than Active State Perl.

Simply install it. That’s it. No need to worry about later locating and installing the Perl DBI and DBD:MySQL modules, as they’re automatically installed. How refreshing!

You can download Strawberry Perl from here:

http://strawberryperl.com

I downloaded the latest GA version: 5.12.3.0, double-clicked on the installer, installed it, and ran the MySQL scripts immediately.

It doesn’t get any easier than that. (I even went ahead and uninstalled Active State Perl altogether.)

In fact, here is the quote on their home page: :)

“When I’m on Windows, I use Strawberry Perl” — Larry Wall

And for reference, here is my new mysqldumpslow output from using the new Strawberry Perl (just to show it’s the exact same as my previous example):

C:> mysqldumpslow.pl -v -s at ..\data\Chris-PC-slow.log

Reading mysql slow query log from ..\data\Chris-PC-slow.log
Count: 1  Time=0.00s (0s)  Lock=0.00s (0s)  Rows=5.0 (5), root[root]@localhost
  select * from t;
  C:\Program Files\MySQL\MySQL Server N.N\bin\mysqld-nt. started with:
  TCP Port: N, Named Pipe: MySQL

Count: 1  Time=0.00s (0s)  Lock=0.00s (0s)  Rows=0.0 (0), 0users@0hosts
  C:\Program Files\MySQL\MySQL Server N.N\bin\mysqld-nt. started with:
  TCP Port: N, Named Pipe: MySQL
  # Time: N N:N:N
  # User@Host: root[root] @ localhost [N.N.N.N]
  # Query_time: N  Lock_time: N  Rows_sent: N  Rows_examined: N
  use test99;
  select * from t

 
 

Added a Table of Contents

Wednesday, November 9th, 2011

Not a big deal, but I just added a “Table of Contents” page to my blog to make finding older articles much easier.

I noticed most of my posts are quite lengthy, and it can take a bit of searching/clicking to find an older entry. So unless you happen to recall the ‘month/year’ it was published, which I don’t even remember that, then hopefully this will help.

Really simple, and looks just like this:

My hopes are that this will aid in making some posts easier to find (such as ones about InnoDB Recovery, Recovery with an Individual .ibd, Proxy-related articles, Error-related articles, How-to posts, and so forth).

You can see the full “table of contents” here:

http://www.chriscalender.com/?page_id=399

Happy reading :)

 
 
 

MySQL Windows Users – Use Grep to Search MySQL Source Code

Wednesday, November 2nd, 2011

For Windows users, if you try searching the MySQL source code for various strings, you know you will often come up empty with the built-in Windows search.

It wasn’t too long ago and I was searching the source for “MALLOC_OVERHEAD”. My Windows search came up empty, and someone suggested I try grep for Windows.

Well, I downloaded it, extracted it to the location I wanted, and added the .exe to the $PATH.

Now I can grep away!

See the new results when searching for “MALLOC_OVERHEAD”:

C:\mysql-5.5\mysql-5.5>grep -r "MALLOC_OVERHEAD" .
./client/mysql.cc:   (longlong) 2*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
./client/mysql.cc:   REQUIRED_ARG, 16384, 1024, 512*1024*1024L, MALLOC_OVERHEAD, 1024, 0},
./client/mysqldump.c:   (longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
./client/mysqldump.c:   MALLOC_OVERHEAD-1024, 1024, 0},
./client/mysqltest.cc:    my_malloc(((PC_MALLOC-MALLOC_OVERHEAD)/
./client/mysqltest.cc:    if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
./client/mysqltest.cc:    pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+
./client/mysqltest.cc:    pa->max_length=PS_MALLOC-MALLOC_OVERHEAD;
./client/mysqltest.cc:    len=(PC_MALLOC*pa->array_allocs - MALLOC_OVERHEAD);
./extra/replace.c:        my_malloc(((PC_MALLOC-MALLOC_OVERHEAD)/
./extra/replace.c:    if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
./extra/replace.c:    pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+
./extra/replace.c:    pa->max_length=PS_MALLOC-MALLOC_OVERHEAD;
./extra/replace.c:    pa->max_length=(pa->length+length+MALLOC_OVERHEAD+PS_MALLOC-1)/PS_MALLOC;
./extra/replace.c:    pa->max_length=pa->max_length*PS_MALLOC-MALLOC_OVERHEAD;
./extra/replace.c:    len=(PC_MALLOC*pa->array_allocs - MALLOC_OVERHEAD);
./include/my_global.h:  something like 1024-MALLOC_OVERHEAD bytes
./include/my_global.h:#define MALLOC_OVERHEAD 8
./include/my_global.h:#define ONCE_ALLOC_INIT           (uint) (4096-MALLOC_OVERHEAD)
./include/my_global.h:#define RECORD_CACHE_SIZE (uint) (64*1024-MALLOC_OVERHEAD)
./include/my_sys.h:#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8 )
Binary file ./MySQL.ncb matches
./mysys/array.c:    alloc_increment=max((8192-MALLOC_OVERHEAD)/element_size,16);
./storage/myisam/ha_myisam.cc:  8192*1024, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), ULONG_MAX, 1);
./storage/myisam/myisamchk.c:    GET_ULL, REQUIRED_ARG, USE_BUFFER_INIT, MALLOC_OVERHEAD,
./storage/myisam/myisamchk.c:    SIZE_T_MAX, MALLOC_OVERHEAD,  IO_SIZE, 0},
./storage/myisam/myisamchk.c:    (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
./storage/myisam/myisamchk.c:    INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0},
./storage/myisam/myisamchk.c:    (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
./storage/myisam/myisamchk.c:    INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0},
./storage/myisam/myisamchk.c:    (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
./storage/myisam/myisamchk.c:    ULONG_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
./storage/myisam/myisamdef.h:#define USE_BUFFER_INIT            (((1024L*512L-MALLOC_OVERHEAD)/IO_SIZE)*IO_SIZE)
./storage/myisam/myisamdef.h:#define READ_BUFFER_INIT   (1024L*256L-MALLOC_OVERHEAD)
./storage/myisam/myisamdef.h:#define SORT_BUFFER_INIT   (2048L*1024L-MALLOC_OVERHEAD)
./storage/myisam/myisamdef.h:#define MIN_SORT_BUFFER            (4096-MALLOC_OVERHEAD)
./storage/myisam/myisampack.c:static uint tree_buff_length= 65536 - MALLOC_OVERHEAD;

 

Unlike the Windows search, which simply returns the file name, this shows the file name *and* the full line of code, therefore sometimes answering my question without even needing to examine the source code.

This full search of the source code (which I had stored in C:\mysql-5.5\mysql-5.5) took only about 2 minutes. This is not bad (and certainly not worse than the Windows search), not to mention there’s no need to index your system, nor build/store the resulting several-GB-search-index-file, aka windows.edb).

Personally, I use the ‘GnuWin32′ grep for Windows, available from SourceForge:

http://gnuwin32.sourceforge.net/packages/grep.htm

I’m sure there are others, but I’ve had great success using many of the GnuWin32 utilities available for Windows.

Happy grepping! :)

 
 
 


Period Panties by Period Panteez Menstrual Underwear Menstruation PMS Panty