LOW COST JAVA PHP MYSQL CGI PERL
HOSTING SERVICE
LINUX WINDOWS CPANEL WHM PLESK
HOSTING PACKAGES
ECOMMERCE HOSTING ASP JSP MSSQL
FRONTPAGE HOSTING
CPANEL WHM RESELLER DEDICATED
SERVER WEB HOSTING

Archive for June, 2007

MySQL Admin Commands

MySQL Admin Commands:

* Statistics: [prompt]$ mysqladmin version
* List database environment: [prompt]$ mysqladmin variables
* Show if database is running: [prompt]$ mysqladmin ping
* Show databases available:

[prompt]$ mysqlshow

OR

mysql> SHOW DATABASES;

* Delete database: mysql> drop database databasename;
* Show list of active threads in server:

[prompt]$ mysqladmin -h localhost -u root -p processlist

* Delete a database: [prompt]$ mysqladmin drop database-name
* Execute SQL from Linux command line interface:
[prompt]$ mysql -h localhost -u root -p -e “select host,db,user from db” mysql
* Execute SQL command file from Linux command line interface:

[prompt]$ mysql -h localhost -u root -p database-name

Comments Bookmark on del.icio.us

Create a MySQL Database From the Shell

Create a database: (Creates directory /var/lib/mysql/databasename)

[prompt]$ mysqladmin -h localhost -u root -ppassword create databasename

(or use SQL command: CREATE DATABASE bedrock;)

Add tables, data, etc:
Connect to database and issue the following SQL commands:

[prompt]$ mysql -h localhost -u root -ppassword

mysql> use databasename; - Define database to connect to. Refers to directory path: /var/lib/mysql/databasename
mysql> create table employee (Name char(20),Dept char(20),jobTitle char(20));
mysql> DESCRIBE employee; - View the table just created. Same as “show columns from employee;”

mysql> show tables;

Comments Bookmark on del.icio.us

Disable Telnet On a Server

Telnet sends clear text passwords and usernames through logins and should be disabled on servers and replaced with SSH.
Enabling telnet is a great security risk to your servers. It should be turned OFF on servers to avoid any further exploits. TELNET server listens for incoming messages on port 23, and sends outgoing messages to port 23.

Follow the steps given below to disable telnet on server.

1. Login to your server through SSH and su to root.

2. Type pico /etc/xinetd.d/telnet

3. Look for the line: disable = no and replace with disable = yes

4. Now restart the inetd service: /etc/rc.d/init.d/xinetd restart

5. Turn off it through chkconfig as well because it can still start through that.
/sbin/chkconfig telnet off
6. Scan your server to ensure port 23 is closed.
nmap -sT -O localhost
Also run ps -aux | grep telnet and if you find anything other than “grep telnet” as result kill the process.

Comments Bookmark on del.icio.us

How to determine boot loader?

Sometimes you may want to find the boot loader on your operating system.

You can use the following commands to check the boot loader.

dd if=/dev/hda bs=512 count=1 2>&1 | grep GRUB
dd if=/dev/hda bs=512 count=1 2>&1 | grep LILO
One of will give the output as given below.

root@server [~]# dd if=/dev/hda bs=512 count=1 2>&1 | grep GRUB
Binary file (standard input) matches
root@server[~]#

Which means its using grub.

Cheers!!!

Comments Bookmark on del.icio.us

extension_loaded() in PHP

PHP 3 and above supports function extension_loaded() which findx out whether a extension is loaded or not.
syntax : bool extension_loaded ( string name )

This function returns TRUE if the extension identified by name is loaded, FALSE otherwise.

This function is not much used in the simple coding of small websites, but when applications are created then for finding out the different extensions loaded with PHP on individual systems this function is used.

For example, if one want to find out whether ‘gd’ has been installed then use this function as follows :
<?php
if (extension_loaded(’gd’))
echo “GD installed”;
else
echo “GD not installed”;
?>

We can use this code on any web page if want to find out if GD support is enabled on our server or not. Nowadays, many servers require GD support for using different image functions of PHP.

There are a number of extensions used in PHP; all the extensions can be found using phpinfo().

Comments Bookmark on del.icio.us

Sending Email From ASP.NET (Version 2.0+)

ASP.NET is Microsoft’s revolutionary web application technology. ASP.NET has many features built in which other web language framworks don’t support, for example AJAX and drag-n-drop technologies.

In this article you will learn how to send emails from an ASP.NET (.aspx) page.

Note: This will only work with version 2.0+ of the framwork.

1) Import the mail namespace into the page.

2) Create the sub-routine that will send the email.

Sub SendEmail(ByVal Sender As Object, ByVal e As EventArgs)

End Sub

To send the mail on page load use the follow sub-routine.

Sub PageLoad(ByVal Sender As Object, ByVal e As EventArgs)

End Sub

Note: All sub-routines must be surrounded by the following tags.

3) Declare the appropriate variables.

Dim msg As MailMessage = new MailMessage()
Dim smtp As New SmtpClient(”smtp.yourdomain.com”)

4) Start adding the appropriate details.

msg.From = new MailAddress(”from@yourdomain.com“, “From Person”)
msg.To.Add(new MailAddress(”
recipient@domain.com“, “Recipient”))
msg.IsBodyHtml = “False”  ‘Set this to “True” if the message body will be HTML.
msg.Body = “Email Body”
msg.Subject = “The Subject”

5) Send the email.

smtp.Send(msg)

That’s how to send an email using ASP.NET 2.0 (+)!

Comments (2) Bookmark on del.icio.us

« Previous entries