Posts

Showing posts from July, 2013

DROP all MySQL Database tables from the command line!!

DROP all MySQL tables from the command line I had a situation today where I wanted to drop all the tables in a database, but didn't have access to a UI like phpMyAdmin. The easiest thing to do would have been to drop the entire database then re-create it, but I didn't have permissions to drop an entire database. After searching around online, this is the best solution I found: mysqldump -u username -p --no-data dbname | grep ^DROP > drop.sql mysql -u username -p dbname < drop.sql rm drop.txt Simple, and only requires 2 lines (ok, a 3rd line for cleanup). What these commands do is basically generated a mysqldump file (which included DROP commands by default), then filter the output to only show the lines that have the DROP statements. The arrow (>) redirects the output to a file. The second line then imports those SQL statements into the database. Another option I have is to use information_schema database and generate an sql script li...

MariaDB Drop in Replacement of MySQL !!

Image
MariaDB                                              MariaDB  is a community-developed  fork  of the  MySQL   relational database management system , the impetus being the community maintenance of its free status under the  GNU GPL . As a fork of a leading open source software system, it is notable for being led by its original developers and triggered by concerns over direction by an acquiring commercial company  Oracle .  Contributors are required to share their copyright with Monty Program AB. MariaDB is a fork of the MySQL database project that provides a drop-in replacement for MySQL. It preserves API/ABI compatibility with MySQL and adds some new features. The original company behind MySQL, MySQL AB, were bought out by Sun which was then bought by Oracle. Recent changes made by Oracle indicate they are movin...

Linux Server Build Date

Find the Installation date for any Linux System Below are the steps for checking the install date of Linux Operation System (Red Hat) – Not official, but useful. There are few ways to find out build date on any linux system. 1.) Using basesystem package installed on system. 2.) Using passwd command to check status of user which is created at system install time by default. 1.)  Using  basesystem  package installed on system: The package basesystem contains no files # rpm -ql basesystem (contains no files) Basesystem defines the components of a basic Red Hat Linux system (for  example, the package installation order to use during bootstrapping). Basesystem should be the first package installed on a system and it  should never be removed. You can check Install Date from this package $ sudo rpm -qi basesystem-8.0-5.1.1 Name        : basesystem               ...

UNIX Load Average

UNIX Load Average: Today suddenly I got alert from Nagios Like "**Current Load is CRITICAL **". After that I have verified the LA on system and Nagios configuration as well.  After doing some further research I have come to know about some interesting topic i.e. "What is Load Average" and "How LA is being calculated". So sharing the thing that I have found. Actually, load average is not a UNIX command in the conventional sense. Rather it’s an embedded metric that appears in the output of other UNIX commands like uptime and procinfo. These commands are commonly used by UNIX sysadmin’s to observe system resource consumption.  Uptime : The uptime shell command produces the following output: [pax:~]% uptime 9:40am up 9 days, 10:36, 4 users, load average: 0.02, 0.01, 0.00 It shows the time since the system was last booted, the number of active user processes and something called the load average. W The w(ho) command produces...

Installing MongoDB on Linux

In Last posts, we have gone through Overview and features of MongoDB.  This tutorial includes: an overview of the available packages, instructions for configuring the package manager, the process install packages from the 10gen repository, and preliminary MongoDB configuration and operation. Actually, we have two ways for installing. 1.) We can download .tgz or tar package and then can compile manually. 2.) We can create a repository, then use yum downloading and installing. Here, I am going through 2nd way: Package Options The 10gen repository contains two packages: mongo-10gen-server This package contains the  mongod  and  mongos  daemons from the latest  stable  release and associated configuration and init scripts. Additionally, you can use this package to  install daemons from a previous release  of MongoDB. mongo-10gen This package contains all MongoDB tools from the latest  stable  release. A...