Automysqlbackup: Skipping the data of table mysql.event

When using automysqlbackup to dump your mysql databases, you might run into the following error:

While you can of course change the automysqlbackup script itself, to add the following line of code somewhere in the automysqlbackup script itself:

The option above is not upgrade proof, as your automysqlbackup script might get overwritten by the new version.

There is however an easier option to accomplisch this, and keep the settings:

Modify or Create your ~/.my.cnf and add the following lines of code to the mysqldump section:

Hope this helps!

MsSQL Database: Drop connections

If you need to restore a Microsoft SQL Database, you might run into the problem that there are still users connection to the database.

It’s not easy to drop those connections… lots of info that I find on google use

And this doesn’t always seem to work on SQL2008 or SQL2012.

But… here’s a handy script that I found on Stackoverflow:

Replace the DB_Name variable with the name of your DB for which you want to drop the connection:

 

Puppet on Windows: set Administrator password to never expires

When maintaining windows server with puppet, it could be interesting to set your Administrator password to never expires.
Since you want to manage your passwords through puppet, and not manually by some hyper active sysadmin, this comes in handy.

Note the fact that it is wise to change passwords now and then 😉

On Windows you can only manage passwords through puppet… not any other expire settings.
You can read here that puppet on Windows does not support manages_password_age.

Therefor, after searching and testing a lot, I came with this class:

You’d think that instead of using WMIC USERACCOUNT, you can use a simple ‘net user administrator /expires:never, but that does not seem to be the case. Although your puppet agent reports that the setting has been modified, it did not… I only got it working with the WMIC command.

Also, when using | in the unless, you need to put the cmd.exe /c in your command. This is intended behaviour because of this:

Exec: Execute external binaries on Windows systems. As with the posix provider, this provider directly calls the command with the arguments given, without passing it through a shell or performing any interpolation. To use shell built-ins – that is, to emulate the shell provider on Windows — a command must explicitly invoke the shell