How to use execute mysqldiff utilities in command line? - mysql

I have two versions of my database. The n and n+1 version. I want to know the difference between the two version. I have downloaded the archive on the link mysqldiff utility
I unzip my archive and went in the bin directory, then i type mysqldiff -help. But at my surprise, i have the following message. mysqldif is not recognozed as command line. Is there any way to install it ?
Thanks

Well, if you read the INSTALL file in the link you gave, it doesn't say to download the archive, it says to install via CPAN.
However, I'm not sure why you'd use a CPAN module or some random Github archive when MySQL distributes a mysqldiff.exe [1] tool itself.
[1] http://dev.mysql.com/downloads/utilities/

I'm the author of that ancient CPAN module and I don't really maintain it any more. It looks like another mysqldiff is offered in the MySQL Utilities suite which seems to be maintained (here's a github clone) and also a lot more sophisticated, so I'd recommend trying that.

Related

Perl: How to deal with a duplicated modules installation?

I'm new with Perl and stumbled on a doubled modules installation.
I made a fresh installation of Strawbery Perl on Windows 10. After that, I tried to update all modules at once by using a command proposed in this answer; :
cpan-outdated -p | cpanm
Unfortunately, it appeared that probably the updates were installed on another location:
whichpm -a Mojolicious
C:\Strawberry\perl\site\lib\Mojolicious.pm
C:\Strawberry\perl\vendor\lib\Mojolicious.pm
whichpm -v Mojolicious
whichpm: WARNING: DUPLICATE module files found for 'Mojolicious':
C:\Strawberry\perl\vendor\lib\Mojolicious.pm
Mojolicious 8.22 (non-core) C:\Strawberry\perl\site\lib\Mojolicious.pm
How to deal whit that case?
How to prevent such cases in further updates?
perl -wE "say for #INC"
C:/Strawberry/perl/site/lib/MSWin32-x64-multi-thread
C:/Strawberry/perl/site/lib
C:/Strawberry/perl/vendor/lib
C:/Strawberry/perl/lib
Everything is working as expected.
There are three sets of installation locations: core, vendor and site.
The vendor directories are usually used by the package managers of linux distros, but it appears that Strawberry Perl includes a number of non-core modules in its distribution (including Mojolicious) and it places these in the vendor directories. This is proper.[1]
The site directories are used for user-installed modules. So your upgraded Mojolicious was installed into the site directories. This is proper.
(More on the differences here.)
This is not a problem because the site directories are placed before the vendor directories in #INC, so the user-installed version of a module is found before the vendor-installed version.
Using the site directories would probably also have been fine since Strawberry Perl doesn't provide a way of managing the distributions it bundles. But using the vendor directories is sure to be safe.

"Fatal error: 'EXTERN.h' file not found" while installing Perl modules

While trying to install Perl modules like JSON::XS or YAML::XS, i receive the same error:
XS.xs:1:10: fatal error: 'EXTERN.h' file not found
I use MacBook, xCode is up to date, everything else that could help is up to date too.
Since OS X El Capitan, Apple introduced System Integrity Protection which restricts writing to /usr/lib /usr/bin and other sensitive directories (even to root or sudo user) that are used by the installation of Perl bundled with the Operating System. This can cause issues when it comes to installing new modules and also if trying to install XS modules ( those linked to external C libraries ).
For this reason you should not consider the default Perl installation as a working development environment, especially if you are installing custom modules.
Check out this thread on PM and others. I had since El-Capitan managed to solve this before by manually building from tarball and adding a few params or environment variables to set the paths believing that it would be best to retain use of the system Perl but this is not the way to go. This makes your environment difficult to build but also brittle and sensitive to OS updates that may either break things in many different ways.
The best practice seems to be starting with a Perl using brew install perl and work in this environment, remembering to setup your bash_profile as directed by the installer.
Also worth remembering to do a brew link perl. If you receive warnings about this clobbering what looks like system Perl libraries don't worry - these are likely modules that were installed by you over the top and it will cause you less trouble to link over these. If you have concerns, make a note of which module installs will be cleared and re-install them once your environment is configured ( ie your module installer approach is configured using cpanm or sticking with the old perl -MCPAN -e shell etc)
This new Perl setup from brew eliminates the need to continuing running sudo which adds another layer of things that can go wrong as environment variables don't follow through and permission conflicts arise etc.
Finally to simplify package/module installation I suggest doing a brew install cpanminus. If you had previously already installed this, you can ensure the paths etc are configured by doing a brew reinstall cpanminus
If you want to take it another step further then you can install perlbrew as well which will give you the ability to run multiple versions of Perl as your user and configure these with their own libs and modules which can be very useful particularly if aligning with your production environment for testing etc.
One problem you may face if moving from system Perl to this kind of approach is needing to deal with any hangovers from installing things with sudo. It wis worth taking a little time to get all this set up right though and your issues going forward will be greatly reduced and you won't be left with that nagging feeling that you don't want to change anything for fear of it all breaking.
I have also come across a Perl Blog Article that suggests a fix for XS issues with perlbrew on Mojave
This Gist described updating your cpan shell install root though this shouldn't be necessary unless your cpan is stuck in an old config after taking steps above.
I've also raised this as a new issue on PerlMonks
After reading https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035624 and installing the Additional headers via
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
I successfully compiled without the missing 'EXTERN.h' error
In order to follow the common advice I also tried with Perlbrew to install a dedicated development version of Perl. Especially with the advice in mind First, do not use the system Perl on MacOS. The installed version is for Apple, not for you (see the discussion here: https://www.perlmonks.org/?node_id=1224727).
Unfortunately, the following error occurred:
Test Summary Report
-------------------
porting/libperl.t (Wstat: 65280 Tests: 35 Failed: 0)
Non-zero exit status: 255
Parse errors: No plan found in TAP output
Files=2653, Tests=1217766, 708 wallclock secs (52.74 usr 9.40 sys + 395.38 cusr 49.90 csys = 507.42 CPU)
Result: FAIL
make: *** [test_harness] Error 1
##### Brew Failed #####
Therefore, I decided to install it the following way (and not following the advice due to the error).
Even after having the above mentioned macOS SDK headers already installed on Catalina (macOS 10.15.2) it didn't work for me. I faced the issue during the installation of the Perl module Mac-SystemDirectory-0.13. The following steps (by identifying the missing file in hope of having a more generic approach for more or less equivalent issues) did the trick:
Locate the header file (in this case EXTERN.h)
sudo find /Library -type f -name EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE/EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h
Ensure the installed Perl version (here 5.18) match the header file:
perl -v | grep version
This is perl 5, version 18, subversion 4 (v5.18.4) built for darwin-thread-multi-2level
Export the path for the C-Compiler (note MacOSX10.15.sdk for Catalina and Perl Version 5.18)
export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE
Invoke the Makefile.PL with perl
perl Makefile.PL
BTW — For anybody who's still struggling with this, my workaround was:
bash% module="Sub::Util" # For example
bash% cpanm --configure-args="INC=-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" "$module"
Please try this
CPATH=$(dirname $(find /usr/local/Cellar/ -name EXTERN.h)) cpan JSON::XS
For Big Sur and perl 5.30, EXTERN.h is at /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE
I'm trying to upgrade CPAN itself and got that error. But I have /usr/bin/cpan and I can't write there so I have to tweak it to write the updated version to /usr/local/bin/cpan.
No promises, but yum install perl-devel worked for me.
As #huyz has helpfully pointed out, if you hit this error on a Mac, you don't have this option, even though this is probably your issue, and you need to follow one of the above methods of getting a version of Perl that isn't missing important chunks, as per other answers.
But if, dear reader, you hit this error on a linux host, as I did, then this might be an option for you.
Building on what E Lisse suggested, you might also have luck looking in
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/
For example:
CPATH=$(dirname $(find /System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/ -name EXTERN.h)) cpan JSON::XS
You could also find where EXTERN.h is located and add that to your shell by default, e.g. in your .bashrc or .zshrc file:
export CPATH=/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/

SMW+ installation in MAMP

I'm trying to instal SMW+ on MAMP on top of an existing Semantic Mediawiki (that installation went fine).
First problem: in Step 3 of the official SMW+ installation guide, the WYSIWYG editor doesn't have a link, and the SMWHalo extension locks up my wiki.
So, in Step 6, I've had to comment out # include_once('extensions/SMWHalo/includes/SMW_Initialize.php'); enableSMWHalo(); and require_once("$IP/extensions/WYSIWYG/WYSIWYG.php");
I figured it was related to SMWHalo on both counts. So, I hop over to the Halo Extension installation guide, which leads me to the Wiki Admin Tool installation guide (no link because I'm a noob), which is where I get stuck. I can't get smwadmin to become executable to save my life chmod +x smwadmin.sh returns nothing, and using smwadmin after that gives me "-bash: smwadmin: command not found"
And there, I'm stuck. My wiki still works just fine with those three lines commented out, but I obviously lose SMW+ functionality.
Any suggestions?
Just switch to regular SMW and use the Semantic Bundle to get a jumpstart. I'm afraid the SMW+ project, for all intents and purposes, is now dead :(

How do I install a program that involves make, configure, and build?

I knew this day would come, so I guess it is here. (P.S. I am on windows XP).
I am trying to use this program here. I installed it fine, but it doesnt seem to work when I type in equations. So I went back to the site and it says I need JRE version 5.0 or above, (check). Then it also says I need dvipng, which I dont think I have.
So I went to the site it tells me to, (here), and I downloaded the most recent one, "dvipng-1.14.tar.gz". I unzipped it and I have it all sitting in one directory.
Ok... now what?
Im afraid I need guidance on exactly how to proceed here. The readme and installation instructions say to run "./configure", then "make", etc, I opened the command prompt and did all that but doesnt recognize. I have never had to build in this way, I always used an IDE for compiling C++ programs that I write myself. (Anyway, why am I even having to make an exe why dont they just make one and let us download that?)
Very confused as to what I need to do here, appreciate some step by step help.
Thank you
Even though Mohammad's problem was solved in the comments, I'll have a go at answering his question:
To run a build system that uses ./configure, you need something that can run shell scripts, as well as the usual suite of unix tools that the script expects, plus a compiler that behaves in the standard sort of way.
The two projects that I know of that do this are cygwin and MSYS. cygwin is aimed at creating a full POSIX environment on windows, while MSYS is an add-on to MinGW that aims to provide just the parts needed to run a ./configure script and build a program.

link to download the mysql source

The closest I can find on mysql.com is something called
Generic Linux (Architecture Independent), Compressed TAR Archive
But thats probably a binary installation too, because it has no 'configure' script. Its rather frustrating. I'm sure I'm just missing something obvious (just like what happens with code sometimes).
Navigate your browser to http://dev.mysql.com/downloads/ and click on "MySQL Community Server"
Next go half way down the page and look in the section titled "Generally Available (GA) Releases" and click the drop-down box under "Select Platform". Choose "Source Code" at the bottom of the list.
A list of source code packages will appear for various platforms. Click "Download" to the right of your platform target. This takes you to a "Begin Your Download" page.
At the bottom you will find a link titled "No thanks, just start my download" which will start your download or may be copied as a link as in the wget example above.
The overall procedure for building MySQL from source is at MySQL Docs - Install Source Distribution and it includes using CMake instead of ./configure (you can yum install cmake if needed (CentOS)).
The Generic Linux (Architecture Independent), Compressed TAR Archive is the title of the source package I used to build from source, so I think you were on the right path.
Install Bazaar and get a latest copy of the tree.
http://dev.mysql.com/doc/refman/5.0/en/windows-sourcetree-build.html
You'll need a MySQL.com account. More about contributing code to MySQL.
It turns out my impatience got the better of me.
A further perusal of the latest documentation indicates that this is the genuine source. And that mysql 5.5 and later no longer uses "configure" (autoconf) but instead uses CMake.
I'm now building mysql from those very sources.