How to Delete Tables and Rows in MySQL
As I mentioned in a previous MySQL post, knowing how to quickly perform database tasks from the command line is a good idea if you are a Linux system administrator. Sometimes, it is the easier way to get things done, especially if you are helping another user and need root access to his or her database.
To delete a table, first login to MySQL:
mysql -u root -p
Enter your password and then switch to the database you want to edit by typing the following at the mysql> prompt:
mysql> use [db name];
Finally, drop the table:
mysql> drop table [table name];
Replace [table name] with the actual name of the table you want to remove.
To remove a row, type:
mysql> DELETE from [table name] where [field name] = 'whatever';
When you are finished, type “quit” to exit.
Tag: delete, drop, linux, mysql, rows, server, tables
How to Connect via SSH
SSH secure iconSSH stands for Secure Shell and is a secure encrypted method of connecting to a server for shell/command line access. It can be useful for shared hosting, virtual private servers, and dedicated servers. Linux server usually come with SSH enabled by default, although some web hosts may disable it for shared hosting accounts.
To connect to your server via SSH, simply type:
ssh -l(username) hostname_or_ip
It will prompt you for a password. Type your password, and you should be connected. Some web hosts may use a different port for SSH, other than the default port (22). If so, you will need to specify it, for example:
ssh -p 2222 -lmyname webserver.com
Normal Linux/Unix shell commands apply, once you are logged into the server. When you are finished, simply type “exit”.
Tag: host, linux, port, secure, server, shell, ssh, unix
Advantages of Open Source Software

Free and open source software is licensed under terms that allow the user to view, modify, and redistribute the source code. Proprietary software usually has license restrictions that prevent this, as is the default copyright in nearly all countries. Because of this, free software licenses are often called “copyleft”, since they have fewer restrictions.
One of the major benefits of open source is that you know exactly what you are getting. There is no hidden code that could do unspecified things to your server. Another benefit is that you can change it to be whatever you want. Google, for example, has their own version of Linux running on their servers.
For a company that has invested money in dedicated servers, another danger of proprietary software is vendor lock-in. If you have purchased software for a server and the vendor goes out of business or decides to no longer support it, you are just out of luck. Using free and open source software, you will always have the code for your software. Even if a business goes under, you can take that code to another one or use in-house programmers to maintain it.
Photo Source: Flickr
Tag: .free, copyleft, dedicated servers, linux, open source, proprietary, software
IBM Declares Firefox Its New Official Browser

Big Blue is not known for making revolution internal changes to its business. After all, the way they do business has worked for over a century. When it comes to technology, however, IBM has lately been very keen to accepting new software, particularly software that is free and open source (such as Linux).
In what will undoubtedly send ripples through the Web, IBM has announced that Mozilla Firefox will be its new official browser. All 400,000 IBM employees are expected to make the switch on their desktops and laptops. IBM believes Firefox is “enterprise ready”, and as more of their products are sold as web applications and cloud services, one can safely assume that IBM will recommend Firefox to their customers.
Since its creation, Firefox has gradually chipped away at the large browser market share held by Microsoft’s Internet Explorer. Over the past year, however, Google’s Chrome browser has stolen some of the spotlight. This move by IBM will certainly give Firefox a boost. For web hosting providers that use IBM’s services, it will make sense to use Firefox, if IBM optimizes their applications with the open source browser in mind.
Source: CNET
Photo: Wikimedia Commons
Tag: browsers, chrome, firefox, google, ibm, internet explorer, linux, microsoft, open source
MySQL Server Optimization
If you are running a dedicated server, optimization is very important to maximize speed, efficiency, and save time and energy. We have already looked at ways to optimize Apache web server, but many dynamic websites also use databases that hold the data for their dynamic web applications.
You can accomplish basic optimization of database tables from within your web-based control panel or in phpMyAdmin. You should do this routinely. But there are also ways you can optimize the server itself to serve databases faster and more securely. Over the remainder of this week, I will show you a few tips to optimize your MySQL server. Today, I will just point you to the right file.
To begin configuring your MySQL server, you will need to locate the configuration file. This will differ, depending on your operating system and even from one Linux distribution to another. Most commonly, it will be in a directory like /etc/mysql, and the file will be called my.cnf. You will need to edit it as root:
# nano /etc/mysql/my.cnf
Tomorrow, we will start to plow through this file for optimization tweaks.
Tag: database, linux, mysql, optimization, phpmyadmin, secure, server
Apache HTTP Server Optimization: Part 1
When running your own dedicated server or even a VPS (virtual private server), it is important make sure your server is running at optimal performance. Apache, the web server of choice for many Linux system administrators, will not automatically make itself stable, secure, and fast. You must do that, and there are several optimization techniques you can use to accomplish it. This week, I will cover a few.
Apache configuration is stored in a file called httpd.conf or apache2.conf, and it most often stored in /etc/httpd or /etc/apache2. To edit the file, you can use “vi” or “nano”.
MaxClients
This setting defines the number of visitors you can have connected at once. You can calculate the visitor capacity your server can support by using this formula:
150 x number of GigaBytes of RAM
For example, a server with 2GB of RAM can have 300 MaxClients. 3GB can support 450. Make it high enough to prevent user timeouts but low enough to avoid causing the server to lockup. A high amount can also make your server an easy target for DoS (Denial of Service) attacks.
ServerLimit
Set this value to the same as MaxClients (i.e. SeverLimit = 150 x number of GB of RAM)
I will continue the series on Apache optimization throughout this week. You can also read your Linux distribution’s specific documentation on Apache to find out specifics, such as where the configuration file is stored.
Source: linuxstuffs.net
Tag: apache, dos, linux, maxclients, ram, server, serverlimit, web server
How To Create Multiple New Users
In Linux, the most common method used to create new users is to use the “adduser” command. This is fine when you need to add one or even a few users, but if you need to add numerous (i.e. 50, 100, or even 500), typing in the adduser command repeatedly can be tedious.
You can simplify it to a degree by creating a flat data file that contains all of the user information and then uploading it all at once. This should shave some time off of the process and get your server ready for business a lot faster. To do this, you need to use the newusers command.
As root, enter the following:
newusers filename
The file should contain a user on each line in the following format:
loginname:password:uid:gid:comment:home_dir:shell
For example, a user named Serious Bob would look like this:
sbob:HcZ600a9:1008:1000:Serious Bob:/home/sbob:/bin/bash
Add more users on separate lines, and save the file as batch-users.txt.
Finally, run the command:
newusers batch-users.txt
Completely Delete Files with Shred

On a Linux dedicated server, the normal method for deleting files is to use the “rm” command. This removes the file from the current filesystem, but what many do not know is that those removed files are usually recoverable. As such, rm is more like putting something in the trash or recycle bin on a desktop.
The only way to effectively delete a file is to overwrite the space the file was using. You can accomplish that with the “shred” command. Just like shredding important physical documents, shred makes sure your files are good and gone, so please use with caution. Once it is gone, it is gone.
On a web server, you may want to make sure you delete sensitive information completely (a database of credit card numbers, for example). To do so, run the following command:
shred filename
You can also shred it a number of times just to be sure:
shred -n 7 filename
This will shred “filename” seven times. For more information about shred, type “man shred” from the command line.
Photo Source: Flickr
Red Hat Introduces Hybrid Cloud Platform
The largest and most successful commercial Linux distributor has announced the release of the first Linux hybrid cloud platform that integrates with many industry cloud services. Until now, the only other hybrid cloud platform was Azure by Microsoft. The comprehensive package, which they are calling Red Hat Cloud Foundations, gives customers the ability to run applications in both public and private clouds.
Red Hat made the announcement this week in Boston at the Red Hat Summit, where they also announced new additions to the Red Hat Certified Cloud Partner Program, namely IBM, NTT Communications, and Savvis. Amazon Web Services was the first partner to join previously.
Red Hat was one of the first commercial Linux distributions that had a large following of desktop users. They gradually moved their business model to servers with Red Hat Enterprise Linux, and have since made the natural expansion into virtualization and cloud computing. Many of the servers that power websites and web hosting providers around the world use their software.
Source: ComputerWorld
Tag: amazon, cloud computing, ibm, linux, red hat, virtualization
Quick and easy sudo trick for servers
Question: I just typed a really long complicated command line string on my server, but I forgot to type “sudo” at the beginning. Is there a quick way to enter it again?
Answer: The history feature in Linux and Unix-like operating systems is truly a beautiful thing. With it, you can easily re-enter commands. But what do you do if you need to re-enter a command but need to add “sudo” to the beginning? On Ubuntu, Mac OS X, and many other servers, “sudo” is the default method used to gain administrative rights, but it must be entered before each administrative command.
There are two ways to fix this. One is to simply press the up arrow. You will again see your command exactly as you typed it. To add sudo to the beginning, press the “Home” key, which should move the cursor to the front. Then, all you have to do is enter sudo, add a space, and press Enter.
An even quicker method is to use “sudo !!” to automatically reload the command with sudo. This will look to the last command entered in the “history” list and run it again. You can also use “!!” without sudo anytime you want to quickly run a command again.
Image Source: Wikimedia Commons
Tag: command, history, linux, mac os x, server, sudo, unix