Extracting single table from huge MySQL dump

During last few weeks I had to work with relatively big MySQL dumps. I had to find interesting rows in about 400 files, each of them taking 40 minutes to import. In order to speed things up, I found simple tool that allowed me to extract only interesting tables.

The tool is actually single Perl script, named extract_sql.pl (available on Github). It allows extracting tables with simple command:

mat@server:~$ extract_sql.pl -t TABLE_NAME -r DUMP_FILE.sql

This command will print dump to console output, so you may want to redirect it to some file:

mat@server:~$ extract_sql.pl -t TABLE_NAME -r DUMP_FILE.sql > table_name.sql

Finally, extract_sql.pl is able to read input from stdin, so it is easy to extract and import single table from compressed dump file:

mat@server:~$ zcat DUMP_FILE.sql | extract_sql.pl -t TABLE_NAME \
| mysql dest_database -u username -p
Read more 

Automated MySQL backup on dedicated server or VPS

I just moved all my small projects to new dedicated server. I have to admit, until now I wasn't paying attention to regular backups. I simply ran mysqldump and copied everything to my laptop every few months. I didn't have any problems with that, as my data was not very critical. But, this time I decided to build something better - I wanted database backups to be generated automatically, at regular intervals.

I knew more or less what to do, I just had to put all pieces together. This tutorial shows necessary steps to build similar solution on your server.

Read more 

Learning ZF2: Application flow

Zend Framework 2

This post covers basic tasks that you may want to do within controller: forwarding to different actions, redirecting, and displaying 404 page. Once again, I will show how this tasks can be achieved in both ZF1 and ZF2.

Read more 

Learning ZF2: The Controller

Zend Framework 2

When Zend Framework 2 was officially released, I wanted to learn it on practical example. So, I decided to use it as a foundation for my new blog engine. Because it is very simple application (just a few classes), I was able to build it pretty easily.

This is first post of short series where I will describe how common problems are solved in ZF2. I will always compare it with similar code written in ZF1-style.

First I'm going to describe some common tasks that you usually do in your controllers: handling input parameters and accessing application services.

Read more 

PHP SDK for CodebaseHQ API

CodebaseHQ

When we started working on Cleeng, we decided to choose CodebaseHQ as our project management and code hosting service. At some point we realised that we could benefit from having a small tool that will automate common tasks like creating topic branches for tickets, marking them as "completed", and so on.

In order to build such tool, I had to create a foundation: small library that can connect to CodebaseHQ API, fetch list of tickets, and post updates. I released it to public - just in case anyone else needed it.

Project is hosted on Github: PHP SDK for CodebaseHQ API

Read more 

Rzut okiem na Zend Framework 2: Event Manager

Logo ZF2

Zend Framework 2 zbliża się wielkimi krokami. Po okresie zastoju zdecydowano się przenieść główne repozytorium projektu na GitHub i bardziej otworzyć się na społeczność - nie trzeba juz podpisywać CLA przed dodaniem swoich łatek. Dzięki temu rozwój wyraźnie przyspieszył, a kod zaczyna się stabilizować.

Read more 

About me
Mateusz Tymek

After compiling my very first lines of code at the age of 12, I became passionate about computer science and technology. Now I'm a PHP developer, enjoying my work as a member of Cleeng team.
Doing some sports in my spare time.

Github activity
  • May 20, 22:26
    Commented on pull request zendframework/zf2#4449
  • May 20, 22:22
    Pushed 13 commits to feature/separate_console_route... at mtymek/zf2
  • May 20, 22:20
    Pushed 9 commits to feature/separate_console_route... at mtymek/zf2
  • May 20, 22:17
    Pushed 1 commit to feature/separate_console_route... at mtymek/zf2
  • May 20, 22:13
    Pushed 2 commits to feature/separate_console_route... at mtymek/zf2
  • May 18, 17:33
    Commented on pull request zendframework/zf2#4449
  • May 18, 12:43
    Commented on pull request zendframework/zf2#4449
  • May 18, 10:07
    Pushed 2 commits to feature/separate_console_route... at mtymek/zf2