Archive for the ‘MySQL’ Category

Frequently Used Mysql Commands for Plesk Control Panel

April 30th, 2012 Comments off

Though there are more number of users of cPanel due to higher number of webmasters demanding for cPanel shared hosting but still, Plesk is one of the best things for managing your windows web hosting accounts. In case you don’t have a password and want to backup or restore the database then you can go for the following commands

mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` dbname > backupfile.sql

This command is used for taking MySQLdump backup of the database as a ‘admin’ user

mysql -uadmin -p`cat /etc/psa/.psa.shadow` dbname < backupfile.sql

This command is used for restoring MySQLdump backup to an empty database as a ‘admin’ user

cat /etc/psa/.psa.shadow

But still having the password with you is important so after running this command one can get the password for admin user in return. But one needs to run it in specific manner as given below.

mysqldump -uusername -ppassword dbname > backupfile.sql

mysql -uusername -ppassword  dbname < backupfile.sql

When you are aware of password you can run the above commands for backup and restoration of you database.

(Note:- replace ‘username’ with your username, ‘password’ with your password and ‘dbname’ with your database name)

mysqlcheck -uadmin -p`cat /etc/psa/.psa.shadow` -r databasename

By running the above command you can perform MySQL check for any possible repairs.

mysqlcheck -uadmin -p`cat /etc/psa/.psa.shadow` -o databasename

The above command is for performing MySQL check for any possible optimization over it.

What Is WAMP And WAMPServer?

January 27th, 2012 Comments off

WAMP is quite a well known term among Website Hosting Services industry. WAMP is acronym for the combination of Windows, Apache, MySQL and PHP/Python/Perl. In this combination the first three are constant ones and for the fourth one it varies among PHP, Python and Perl. There may be a few occasions in which Python and Perl can be used together. The reason behind the popularity of WAMP is because it provides four important elements Operating System, Database Web Server and scripting application which are required for a web hosting server. When all these four elements are used as combined then such a usage is called as ‘Server Stack’. In this (WAMP) server stack you use ‘Microsoft’ Windows as an operating system, ‘Apache’ as a Web Server, MySQL to work as a Database and you can choose one from PHP, Python and Perl to be used as scripting language. WAMP it is totally related with Windows Web Hosting Servers and has nothing to do with Linux Hosting Servers. For Linux Hosting users there is ‘LAMP’ which substitutes ‘WAMP’

To adopt WAMP one needs to download ‘WAMPServer’ which is an open-source Windows web development environment. It comes with a service manager as a tray icon. This enables an easy management of the server and easy installation of multiple releases of Apache, MySQL and PHP as add-ons. With WAMPServer the installation process is automated and you can secure your setting files while making any changes over your web servers. You can experience a great flexibility with ‘WAMPServers’ as enabling and disabling services of WAMPServer is just a matter of clicks.

With a left click on WampServer’s icon, you will be able to:

  • manage your Apache and MySQL services
  • switch online/offline (give access to everyone or only localhost)
  • install and switch Apache, MySQL and PHP releases
  • manage your servers settings
  • access your logs
  • access your settings files
  • create alias

With a right click :

  • change WampServer’s menu language
  • access this page

How To Set Up The PHP / MySQL Site Definition In Dreamweaver

November 15th, 2011 Comments off

‘Site Definition entries’ used while defining a site play an important role in connecting a MySQL database in ‘Dreamweaver’ successfully. Here I would like to share an example of PHP / MySQL Definition which uses a Linux Hosting Server with PHP and which runs over a machine named such as, and MySQL runs on other machine which can be named such as, furthermore the ‘Dreamweaver should be running on a local workstation.

In this tutorial, we will be using FTP for the purpose of transfer of file between the Linux Hosting server and workstation.

Local Info:
Site Name: mywebsite
Local Root Folder: C:\mywebsite\
Remote Info:
Access: FTP
FTP Host:
Host Directory: /htdocs/
Login: Admin (Your Log In Name)
Password: ********* (Your set Password)
Testing Server:
Server Model: PHP / MySQL
Access: FTP
FTP Host:
Host Directory: /htdocs/
Login: Admin (Your Log In Name)
Password: ********* (Your set Password)
URL Prefix:

Most Frequently Used MySQL Commands (Tables) – III

August 2nd, 2011 Comments off

Tables are the very important parts of a MySQL Database and one must know the commands of handling tables and records in it to operate a MySQL database on a Web Hosting server. In this post I have mentioned many MySQL commands which are related to table with their short descriptions.

mysql> SELECT * FROM [table name];
This is a very basic command which a users learns at the start of learning MySQL. It is used for displaying all the records of a table.

mysql> show columns from [table name];
This command returns the columns and other information about them related to given table name.

mysql> SELECT * FROM [table name] WHERE [field name] = “0999”;
This command returns the certain selected rows which contains value “0999” as the field name.

mysql> SELECT * FROM [table name] WHERE name = “abc” AND number = ‘1234567’;
This command returns all records after checking the given conditions for two fields.

mysql> SELECT * FROM [table name] WHERE name != “abc” AND number = ‘1234567’ order by phone_number;
Returns all records which do match with the given conditions.

mysql> SELECT * FROM [table name] WHERE name like “abc%” AND number = ‘123’;
Returns all records which starts with particular letters ‘abc’ AND the number ‘123’, its useful to be used a find with uncertainty of the records.

mysql> SELECT * FROM [table name] WHERE name like “abc%” AND phone_number = ‘1234567’ limit 1,9;
Very similar to the previous command but just applying the limitation on the display of number of records.

mysql> SELECT * FROM [table name] WHERE rec RLIKE “^a”;
With the use of this command you can extract all the records starting with smaller case ‘a’ that means you can search the records starting with a particular letter being conditional to case sensitive.

mysql> SELECT DISTINCT [column name] FROM [table name];
By using this command you can find records which are unique.

mysql> SELECT [col1],[col2] FROM [table name] ORDER BY [col2] DESC;
This command is used to display the records from particular fields and sort then in the required order according to given field, i.e. with the above query you can find the records of column 1 and column 2 and they will be displayed in descending order as per the records of column 2.

mysql> SELECT COUNT(*) FROM [table name];
This command returns the number of rows (records) in a table.

mysql> SELECT SUM(*) FROM [table name];
You can perform the sum of records of columns of a table.

Most Frequently Used MySQL Commands – II

July 30th, 2011 Comments off

Continuing from the last post I am carring one few more MySQL commands in this post which are mostly related to handling your database, at your web hosting account.

# [mysql dir]/bin/mysql -h hostname -u root -p

Use this command to login (from unix shell), though using -h is not necessary each time.

mysql> create database [databasename];

This commands creates the database as per your desired name.

mysql> show databases;

You can view the List of databases already exists.

mysql> use [db name];

You can switch to your desired database from the current one.

mysql> show tables;

You can use this command to view the list all the tables in the database.

mysql> describe [table name];

To know the formats of fields of a database you should use this command.

mysql> drop database [database name];

If your find out any unnecessary database in your account then you can delete by using the above command.

mysql> drop table [table name];

If you want to delete any particular table from a database then you can use this command.

Note :- Others MySQL commands related to tables will be shared in upcoming posts.

Most Frequently Used MySQL commands – I

July 30th, 2011 Comments off

Being an open source platform, MySQL is one of the greatest utility for web hosting services providers and their clients to manage their databases, furthermore it can be used with both most widely used platforms of Windows web hosting as well as Linux Hosting. MySQL is a fast, robust, secured with encryption and also has very easy installation process. Following are few commands mostly used while operating MySQL.

ps -auxwww | grep mysql

This command is used for Checking whether MySQL Server is running or not

./bin/mysqld_safe &

For Starting mysql you should use this command

./mysqladmin -u root shutdown

After the work completed for Shutting down the MySQL you need to use this command.

cd mysql/bin
./mysqladmin -u root processlist
./mysqladmin -u root kill ProcessID
Any help required about mysql can be opened by enterting this command.

This is a useful command to check which query is running on which host, from which location query has been fired , which query has locked which table etc.

cd mysql/bin

This command is used to Kill processes

mysql> help alter;


You can Repair a table by using this command.

Note :- Few more MySQL commands will shared in upcoming posts.