Import and Export Large MySQL Database

For most of the time, web-based database management control panel such as phpMyAdmin does the job well for importing and exporting backups. However, as your database grows larger and larger, it will reach to a point where it can no longer be done using any web-based control panels anymore.

For instance, our database has reached 500mb just a couple of months ago and phpMyAdmin would stop halfway when doing the job and showing a timeout message. It’s a standard for web server to stop loading a page and declare as timeout once it waited for a certain amount of time. You can of course change the web server configuration to make the timeout really really long but that is not practical and may break your web server.

A better way would be using the command line tools came together with MySQL. Let’s try to import a large database using the command line tool. The first thing you need to do is to open up the command prompt, or terminal. For Windows operating system, you need to access to the bin folder in your MySQL installation directory, for example:

cd C:\xampp\mysql\bin

Then, use the following command to import the SQL file to your database.

mysql -u username -p database_name < file.sql

Then, a message will pop out and ask for the database password. Insert the correct password and wait for a while until all the data is being loaded to the database. If you see your mysql directory is showing in the next line, it means the operation has be done. Your command prompt should look something like this:

Next, we will export our database using the command line tool. This time, we will be using the mysqldump utility. To export your database, type in this command line:

mysqldump -u username -p database_name > file.sql

If you don’t specify a target destination for the file, it will be saved to the bin folder, in this case, C:\xampp\mysql\bin.

That’s all! It’s very easy and quick once you’re familiar with the command line.

Change Unity3D Build Target Using CMD

Most people probably won’t need this, unless you encountered such scenario:

You're handling a huge project, and you somehow need to move the entire project folder from a Windows machine to a Mac for porting the project to iOS.
What will happen is when you open the project for the first time on Mac, Unity will load all the files and convert them into Windows formats because well, your project was set to run on Windows previously.
You waited for half an hour or so for all the files to be converted (it' a huge project!) and now you must change the build settings again, and wait for another half an hour for it to be converted to iOS!

If you want to avoid running the conversion twice, you can change your Unity project’s build target before opening the editor, by using the command prompt, like so:

Windows:

"C:\Program Files(x86)\Unity\Editor\Unity.exe" -buildTarget 

Mac:

/Applications/Unity/Unity.app/Contents/MacOS/Unity -buildTarget

Possible options are: win32, win64, osx, osxintel64, osxuniversal, linux, linux64, linuxuniversal, ios, android, web, webstreamed, webgl, xbox360, xboxone, ps3, ps4, psp2, wsa, wp8, bb10, tizen, samsungtv

For example:

"C:\Program Files (x86)\Unity\Editor\Unity.exe" -buildTarget ios

This way, Unity will straight away convert your project files to iOS formats and no need to convert it twice. Time saved!

View Debug Messages on Android

If you’re currently developing any android apps, you might be wondering how to check debug messages when running the apps on a physical device. Android SDK actually comes with an utility called Logcat, which does exactly that.

If you’re running Eclipse IDE and it is not showing any debug messages, your Eclipse is probably not linked to the Logcat. You can set it up by going to:

Window -> Show View -> Other… -> Android -> LogCat

However, if you’re running other development tools that don’t support this feature (such as Unity Engine), you can fire up Logcat manually by using the command pad/terminal.

On Windows, you need to enter the (android sdk folder)\platform-tools folder before calling Logcat:

cd C:\android-sdk-windows\platform-tools

After that, you can call Logcat by first calling the ADB (Android Debug Bridge) and launch Logcat from it, like so:

adb logcat

However, if you’re just calling adb logcat you may see the terminal going crazy by showing tons of debug texts in crazy speed. This is because the Logcat is actually displaying debug texts of ALL the processes running on your device. You definitely do not want that, don’t you?

You can add an extra parameter behind the command which filters out the process list and only display your app. For example, if your app is built using Unity Engine, you can call:

adb logcat -s Unity

…which looks like this on the terminal:

That’s all. You can now easily debug your app and know exactly what’s going when bugs occur. Happy debugging!