Category Archives: Linux

Importing Large MySQL Files With phpMyAdmin

It may not be possible to import large SQL files using phpMyAdmin due to it’s uploading limits.
Sometimes this is related to your php.ini settings, but no always.

You can always use the old reliable method of importing sql files from the command line. Or upload to file to server and tell phpMyAdmin to look for that file specifically.

MySQL Command Line Option

Of course, we need to upload the file first. Below, the 1st line is to achieve this. After that we connect to our server via ssh, and then (on the 2nd line) import the sql file.

scp the_sql_file.sql
mysql -u username -p -h localhost DATABASE-NAME < the_sql_file.sql

Here, the MySQL connection is established using a username and password. If you simple create a .my.cnf file in order to get automatic connections, you won’t need all these. Simply create a file to /root/.my.cnf (or any other user directory you want to)


From now on, you don’t need to use the -u and -p arguments when using mysql, if this file exists at the user’s home directory you’re logged on as, than it will automatically pass them. It may seem insecure, but the /root folder is only accessed by the root anyway, even though it is not a good idea to keep passwords clear text, if your /root folder is compromised, you’re in big trouble anyway. And keep in mind that we usually have to keep MySQL passwords a cleartexts in scripts all the time.

Using phpMyAdmin to Import the SQL File

You can set a default folder for phpMyAdmin to check for uploaded files. This way, if you place a file into this folder, you can easily choose to import it. Find where your file is. If you don’t know where, try the locate command (if it is installed). Open the file and find the $cfg[‘UploadDir’] section. Update it as below

$cfg['UploadDir'] = 'imports';

Now, phpMyAdmin will check the “imports” folder directly. So we need a folder like that. On your terminal, create the folder.

mkdir /path/to/phpmyadmin/imports

Now upload your sql files here.

scp /path/to/the_sql_file.sql

Change the owner and group of the imports folder. First check who owns the phpmyadmin folder. Let’s say it is called webapp,

chown -R webapp:webapp /path/to/phpmyadmin/imports

Ok. Now use your browser and access phpmyadmin, at the import db seciton you’ll see a dropdown menu that wasn’t there before. There you’ll see the files inside the “imports” folder. Even though they are larger than the phpmyadmin upload limits, they’ll get imported.

Quota Problems With DirectAdmin

I see this is a very common problem. Sometimes people get an error on their IMAP webmail connection and checking the log files at /var/log/maillog there’s an error indicating the disk quota for that user.

Jul 2 11:08:51 mail dovecot[1227]: imap( Error: user Initialization failed: Initializing mail storage from mail_location setting failed: mkdir(/home/someuser/imap/ failed: Disk quota exceeded

The generally people claim that playing around with the disk quota of the user helps it. Interestingly in my case, only setting the quota to “Unlimited” solved the problem. So keep that in mind.
It seems like the reason behind this error is that dovecot used to handle quotas using the /var directory, but now switched it to the /home directory.

Also if somehow your system starts reading quotas wrong, don’t forget to use this little tip :

echo “action=rewrite&value=quota” >> /usr/local/directadmin/data/task.queue

This command will go through each user, and set the quota limits in the system quotas.  Users will unlmited quotas will also have their quota limit set to 0 (unlimited).

echo “action=rewrite&value=quota&user=bob” >> /usr/local/directadmin/data/task.queue

Same thing, except it’s just sets the quota for one user.


Ubuntu 13.04 Personal Post-Installation Settings

Here’s my to-do list after installing a fresh Ubuntu 13.04. Some of them are probably very personal and you won’t need them, yet it might give an idea.


First of all I edit the settings of gedit.

Edit -> Preferences
View tab : Check “Display line numbers”, “Enable text wrapping”, “Highlight current line” and “Highlight matching brackets”
Editor tab : Set the tab width to 4 and check “Insert spaces instead of tabs” and “Enable automatic indentation”



Next, I install and personalize Geany. I’ve discussed the necessary steps before on this post.


Unfortunately the VI that is shipped with Ubuntu is buggy. I usually replace it with VIM.

$ sudo apt-get install vim

After this, I update the vimrc file to personalize. I’ve talked about it in this post.

Sublime Text Editor

This is another very well designed text editor. I like installing and personalising it. You can find methods to install it in this post. I prefer using Sublime Text 3, and then using the following settings in the configuration file.

    "tab_size": 4,
    "use_tab_stops": true,
    "detect_indentation": true,
    "auto_indent": true,
    "smart_indent": true,
    "highlight_line": false,
    "draw_white_space": "all",


First of all I install the ssh server.

$ sudo apt-get install openssh-server

After this, I simply “ssh localhost” in order to get the ~/.ssh folder created.
After this, I copy my id_rsa and files into this folder.
$ chmod 700 ~/.ssh/id_rsa
$ chmod 664 ~/.ssh/

If you want, maybe it’s a good idea to change your default ssh server port.
Edit /etc/ssh/sshd_config and change the line below

# What ports, IPs and protocols we listen for
Port 22

If you change the port, you’ll have to restart the ssh server.$ sudo /etc/init.d/ssh restart

After these, I install the PAC-Manager from it’s website :

Then simply import my old PAC connections.

Browsers and Dropbox

Well, the title speaks for itself. I usually get Chrome, Opera and Dropbox right after the installation.

Aptitude Installations

Downloading GIMP, Restricted-Extras, VLC are usually critical.

$ sudo apt-get install gimp ubuntu-restricted-extras vlc

Getting ffmpeg, avconv, and java plugins is a good idea.

$ sudo apt-get install ffmpeg libav-tools libavformat-extra-53 libavcodex-extra-53 icedtea-7-plugin openjdk-7-jre

Using the right-click menu on nautilus to open a terminal in that folder is very useful.

$ sudo apt-get install nautilus-open-terminal

Below are for the fundamental tools for network geeks.

$ sudo apt-get install nmap mtr filezilla

For monitoring a lot of things, atop is very useful.

$ sudo apt-get install atop

As an astronomer, I use numpy and pyfits for scientific computing a lot.

$ sudo apt-get install python-pyfits python-numpy

If you’re using Skype, it won’t be visible in the system tray, to fix this, install the following package. (discussed here)

$ sudo apt-get install sni-qt:i386

Adjusting rc.local

In order to automatically turn on Numlock at boot, and (on my laptop) remember the brightness setting, I edit the /etc/rc.local file accordingly. The brightness thing is because, my Ubuntu boots with minimum brightness on laptop. Also to turn on automatically, you need to install the numlockx package.

$ sudo apt-get install numlockx

Add these lines to the /etc/rc.local file:

# Numlock enable
[ -x /usr/bin/numlockx ] && numlockx on

#Auto set brightness (change the value "12" for your system)
echo 12 > /sys/class/backlight/acpi_video0/brightness

exit 0

Show Date in Panel

It is good to see the date in the top right corner of the screen at all times.

Click on the clock and follow Time & Date Settings… -> Clock tab -> Check “Date and month” below the “In the clock, show” section.


Import Filters for Thunderbird

Using this addon, you can import your “exported” filters for Thunderbird.

Privacy Settings

I usually edit the privacy settings of the Unity Dash so that it won’t record activity on my multimedia files.

Just type “privacy” to the dash and run the settings. On the “Files” tab, select the type of files you don’t want to be recorded.



Install Google Calendar Indicator

This was discussed in a blog post, if you use Google Calendar, then it’s a good idea to integrate it with your Ubuntu. Check it out here.

Disabling the ALT Key for HUD

Some programs use the ALT key and since the HUDS want to access it, things can get messed up. That’s why I usually disable the hotkey. It was discussed here before. Simply click on the System Settings… Go to “Keyboard -> Shortcuts” select “Key to show the HUD and hit “Backspace” if you want it disabled.

Shortcut for minimizing Windows

While disabling the ALT key for HUD, it’s a good idea to also add the minimization shortcut. While at “Keyboard -> Shortcuts” go to “Windows” and add the key combination you like. I usually prefer “Ctrl +Alt + 0”

Disable Recursive Searching in Nautilus as you Type

For me, this is the most annoying updates of Nautilus. When I want to search for something, recursively, I can either use “find” or “locate” or simply hit “search”. Locating files easily in a folder with nautilus is something I use a lot, that’s why this patch is very handy. Follow the instructions in the link below if you don’t like that feature either.

Personalize Geany

Even though I usually develop using gedit, sometimes it’s nice to use geany as an IDE. I usually install geany and personalize it to look (almost) like gedit. I use this blog post but change some of it. Geany is better for coding in some ways, especially code folding and column selection (ctrl+shift+select) is a plus.

$ sudo apt-get install geany

Now run geany and go to the preferences menu.

Edit -> Preferences
General > Startup : Uncheck “Load virtual terminal support”
General > Miscelaneous : Check “always wrap search”
Interface > Uncheck “show side bar”
Interface > Toolbar > Click the “Customize Toolbar” Button
Remove “Undo, Redo, back, forward, compile, execute, build, color chooser, quit” (if you want, maybe don’t remove Undo and Redo?)
Iconsize : Small
Editor > Set Indentation Widthto  4,  Type : Spaces
Editor > Check “line wrapping”
Editor > Line breaking column : 80
Editor > Display > Set Long line marker : column to 80
Editor > Display > Set color to #98A8B6
Files > Check “Replace tabs by space”

Save these settings by clicking “Apply”.

To Remove the message pane, uncheck “View -> Show Message Window”
Enablig Export Plugin is good if you like exporting as LaTeX or such.

Tools -> Plugin Manager -> Enable export

Now you’ll have a better looking Geany to develop.