Thursday Nov 05, 2009

My Last Day at Sun - 06 Nov 2009

Today is my last day at Sun . I will miss my team and sun culture . Thank you Sun for giving me an opportunity . Its been a privilege !

If you want to get in touch with me, please use linkedin to send a message :

Monday Sep 14, 2009

How to Test External Sites (Internet Sites) using Selenium

[Article by]

    Problem :

    If your testing site (ex: / is behind the proxy then selenium fails to access the site. 

    Because selenium itself acts as proxy to AUT (Application Under Test) and which fails to resolve internet sites behind proxy. site says using proxy options, while starting the server will help to resolve the external sites.

    i.e java -jar selenium-server.jar -Dhttp.proxyHost=<proxyHostName> -Dhttp.proxyPort=<proxyPort>

    But the above solution doesn't resolve the issue.

    Before jumping in to solution let us see how selenium server invokes browser and access the internal/external sites.

    When we invoke NewBrowserSession Request to selenium server (i.e selenium.start()) the following background steps are performed.

    For \*firefox/\*chrome:

    1)Extract the CustFirefoxProfile bundled with selenium server.

    2)This will make sure clean firefox session for every new browser session.

    3)Command line jvm proxy settings does not affect to the new firefox session.

    For \*iexplore:

    In case of Internet Explorer , it will simply create custom profile from the current IE instance settings.

    So, for IE simply set the browser proxy to access the internet sites and running tests on internet sites will work. We need solution only for firefox/chrome browser sessions. 


Solution :

    1) Extract the selenium-server.jar using WinRAR/7zip/Winzip archive tool.

    2) Copy "customProfileDirCUSTFF" to a new folder as "MyProxyFirefox"

    3) Under "MyProxyFirefox" folder create firefox user settings file.

       (i.e create a New Text File with Name "prefs.js" with out quotes. Extension of File Should be .js)

    4) Now copy the following properties to prefs.js file.

       user_pref("network.proxy.type", 1);

       user_pref("network.proxy.ftp", "");

user_pref("network.proxy.ftp_port", 8080);

user_pref("network.proxy.gopher", "");

user_pref("network.proxy.gopher_port", 8080);

user_pref("network.proxy.http", "");

user_pref("network.proxy.http_port", 8080);

user_pref("network.proxy.share_proxy_settings", true);

user_pref("network.proxy.socks", "");

user_pref("network.proxy.socks_port", 8080);

user_pref("network.proxy.ssl", "");

user_pref("network.proxy.ssl_port", 8080);

user_pref("network.proxy.no_proxies_on", "localhost,,");

   5) Now replace "" with your Web Proxy and also replace "8080" port with the webproxy port.

   6) For By Pass the Proxy for Internal Sites then update last property value with comma as separator.

      i.e network.proxy.no_proxies_on

   7) Now start the Selenium server with the following options.

   i.e java -jar selenium-server.jar -firefoxProfileTemplate MyProxyFirefox


Thursday Jun 18, 2009

How to setup a Test Automation Infrastructure using Selenium, JUnit, Hudson & ANT

Goal : Setting up a test infrastructure & automation solution for web application testing (functional testing)

Tools : JUnit, Hudson, Selenium RC, Ant, Xalan


  • Automation should start the tests immediately when a new build is available in the SVN repository (Hudson has scheduling capability)
  • Automation can be invoked using a browser On-Demand, whenever user needs to run tests on a build (User can trigger tests in Hudson using a browser URL)
  • Automation should be running on multiple OS machines & browsers (Hudson Master/Slave approach will solve this issue)
  • Once the automation is completed, it should send a report as an email to the team alias. Old reports also needs to be archived.
  • User should be able to run the automation as a seperate ANT task & from Netbeans IDE
  • Reports can be automatically published as a wiki page in a wiki system which the team uses for project management (Note: This solution will be covered in a seperate blog & NOT in this)


1. Install Hudson in Master / Slave mode

2. Prepare ant scripts so that it will

  • Checkout the product from SVN repository and installs it on test machine
  • Do all the pre requisite for successfully running our tests [Start selenium server and the tests]
  • After the test execution is completed, archive the old reports and save the new report and email it to the team alias.
  • Do all the necessary cleanup at the end

3. Now call these ant scripts within Hudson and schedule it to run as per your requirement

Wednesday Apr 22, 2009

My Community Equity

This blog vaguely shows some of my Community Equity (CE) which is measure for the contribution, participation, skills and role equity of a person


Wednesday Apr 08, 2009

KeyBoard Events in Selenium

Requirement : Need to press "Page Down" key during one of the selenium tests

Solution:  Use typeKeys(locator,value) command to generate a keystroke event.  
In some cases, you may need to use the simple "type" command to set the value of the field and then the "typeKeys" command to send the keystroke events corresponding to what you just typed.

locator can be '//' in this case
value can be the ASCII value of the keyboard keys. Refer the below table for examples

8 Brower Back Button
32 SpaceBar Key (also Page Down key)
33 Shift+SpaceBar key (also Page Up key)
34 (or) 35 (or) 36 Page Down key
Up Arrow
112 Opens a new browser page
116 F5 key (Refresh Browser Page)
118 F7 key (Caret Browsing On)
122 F11 key

Sunday Mar 29, 2009

Selenium Test project based on Netbeans (for dummies)

Here is a simple Netbeans based Selenium Test project that will open Google, enter a keyword and search . You can download the entire netbeans project and then open the project from your Netbeans IDE and run it locally. Before running it, you need to satisfy the below pre-requisites: 

  • selenium-server.jar should be running (java -jar selenium-server.jar)
  • firefox should be installed in your machine


Wednesday Oct 15, 2008

Online Free PDF Editor - PDFescape

Recently i wanted to do some editing on a pdf file . Found this wonderful free website which allows you to edit your pdf online. 

Wednesday Aug 06, 2008

Online Centimeter Scale

Recently i was purchasing a item online and i had to accurately mention the size (in cms) of the item . I didnt have a scale with me, but thought i could get a idea of the measurement by looking at any of the online centimeter scale in the internet.Below are the online scale for 1 cm and 0.5 cm  

(1) 1 cm scale -

(2) 0.5 cm scale -

Monday Jul 28, 2008

Do i look like Michael Dell? :)

Few years back , one of my friend who was working with Dell BPO told me that i looked like their CEO :)  well after searching Google for some of Michael Dell's photo, i saw that there is a slight similarity. May be folks who work with me at office may agree to this. 


Friday Jul 25, 2008

Reverse XPath - Finding the xpath of a element using bottom up approach

Assume that we need to find the xpath of a link "Login" appearing in a webpage. Usually when we find xpath of a GUI element, we normally follow a top-down approach, meaning the xpath is recorded from the parent level to the child. But there is also a bottom up approach, where in you can begin from a inner child element and navigate all the way up till the GUI element is reached. 

Below is the corresponding xml code and various method of finding XPath of "Login" link. The bottom-up approach is explained by note (e) in the below table.

 Sample XML Code

(a) Using Top Down approach starting from a top node 

(b) Directly accessing the child node using its text value

(c) Directly accessing the child node using child's attribute value

(d) Directly accessing the child node using wildcard search. All occurences of text "Logi\*" is matched by below xpath.It will work in this example since there is only one text "Login" which has occurence "Logi" in it.

(e) Using Bottom Up approach starting from another child node and navigating to the actual node. Note: Here the DOM structure should be maintained (as it is in the xml) between the start node and end node


Monday Jul 21, 2008

Handling child window in selenium using selectWindow()

Here is a scenario which shows how to handle a child window using selenium .

Web application under Test : Liferay Portal
Browser Used : Firefox
XPath Tools  : Firebug

STEP 1: First Identify the window name of the child window which the web application calls. You can use firebug tool to inspect the GUI element to see these details. In the example below, the "select" button is going to invoke a child window "structure"., windowName, windowFeatures, replaceFlag)

STEP 2: Once you identify the child window name, then within your automation script, call the below selenium command "selectWindow" with the child window name as the parameter . Here in this example the corresponding command is browser.selectWindow("structure")

Now the focus goes to the child window. What ever you execute after the above command takes place in the child window .

STEP 3: Inorder to get the focus back to the parent window, you have to again use "selectWindow" with the parameter as null. browser.selectWindow(null)

Tuesday Jul 08, 2008

Identifying XPath of a element using XPath Query

Below are some of the common xpath query which you will need while doing your selenium automation. Using xpath query, your selenium testing much stable since the slightest change of the GUI wont break your automation.

GUI Element
Corresponding XPath
<input type="submit" value="Save"/> //input[@value="Save"] Exactly matches the text "Save"

<input type="submit" value="Save1"/>

<input type="submit" value="Save2"/>

(//input)[1]   matches the 1st input element, "Save1"

(//input)[2]   matches the 2nd input element, "Save2"

<a href="somelink">Structure</a>
Exactly matches the value within a given tag. Here the text "Structure" which is in between the <a> tag (anchor tag)
<a href="somelink">x_structure_y</a> //a[contains(text(),'structure')]
Like wildcard search, matches the input element which has the text "structure" within a given tag
<input type="button" name="ccd_ccd_81533739_removeevent"/>

//input[contains(@name,concat("ccd","_","ccd","_")) and contains(@name,"removeevent")]

Note: The above xpath can be used when the attribute value has a part which is dynamic in nature (here in this case the text in between "ccd_" and "_removeevent" '81533739" keeps on changing everytime the GUI element is accessed)

Matching multiple text(s) pattern of a attribute value
<input type="text" value="Search..."/>
//input[@type='text' and contains(@value,'Search')]
Matches based on multiple attributes of a GUI element . Here the xpath of the text box is derived  based on its 'type' and 'value' attributes

Tuesday Jun 17, 2008

Address Book provider channel(UWC) and Sun Portal Server

Problem: Cannot make Sun Portal Server to work with Sun Messaging Server (specifically Address Book)

Legend :  Sun Portal Server comes with a Address Book provider channel wherein you can get sun UWC messaging server's address book details pertaining to each users.

Solution: To get it working with Sun Portal Server , do as below:

-o Login to sun portal server psconsole -> Create a new Channel based on Address Book JSP Provider [Note: Let the channel use the  default SUN-ONE-ADDRESS-BOOK sso adapter template]

-o Now click on SSOAdapter tab in psconsole  -> Go to GENERIC_TEMPLATE
-o Select SUN-ONE-ADDRESS-BOOK and provide appropriate details of your UWC server as mentioned in the below screencast
-o You can use /opt/SUNWmsgr/sbin/configutil | grep <sun-one-address-book-textboxfields>
to get the values for each of the text fields while editing the SUN-ONE-ADDRESS-BOOK template

[Note: This forum link was useful]

Monday Jun 02, 2008

Exception while invoking JCAPS API

Problem: The CMS workflow portlets in Sun Portal Server 7.2 release depends on Java CAPS installation . Sometimes if the LDAP of JCAPS is not running , then the CMS portlets will throw the below the error: "Exception while invoking JCAPS API"

Solution: Stop JCAPS Appserver >> Start LDAP >> Now start Appserver again

Background info : Sun Portal Server 7.2 release has a JSR 170 based Content Management System(CMS) portlets in it. The CMS portlets has a workflow capabilities which is provided by Java CAPS.

Monday May 12, 2008

XPath: Matching a node element having a specific text



Problem : To identify uniquely a GUI element having a text "Enterprise Sample" within its <a> tag

Solution : The page source of the web page shows the element as  <a href="clickme.html">Enterprise Sample</a> . Use the below command in xpath checker to uniquely identify this element


In layman's term, the above command will look 

  1. first for all occurrence of <a> tag within the web page
  2. then matches the value of <a> tag with user's text (here "Enterprise")




Monday Mar 31, 2008

Automation using ANT - Reading from a file

Reading values from a external file [Read More]

Sunday Mar 30, 2008

Automation using ANT - Replacing tokens in a file

Replacing a tokens of a file with the values provided in another file
[Read More]

Sunday Mar 23, 2008

When MySQL Server doesnt start properly

I've found these resources on MySQL site which can help you in case you are stuck unable to start the MySQL server properly. 

Below is the actual content of the above URL Unix Post-Installation Procedures

After installing MySQL on Unix, you need to initialize the grant tables, start the server, and make sure that the server works satisfactorily. You may also wish to arrange for the server to be started and stopped automatically when your system starts and stops. You should also assign passwords to the accounts in the grant tables.

On Unix, the grant tables are set up by the mysql_install_db program. For some installation methods, this program is run for you automatically:

  • If you install MySQL on Linux using RPM distributions, the server RPM runs mysql_install_db.

  • If you install MySQL on Mac OS X using a PKG distribution, the installer runs mysql_install_db.

Otherwise, you will need to run mysql_install_db yourself.

The following procedure describes how to initialize the grant tables (if that has not previously been done) and then start the server. It also suggests some commands that you can use to test whether the server is accessible and working properly. For information about starting and stopping the server automatically, see Section, “Starting and Stopping MySQL Automatically”.

After you complete the procedure and have the server running, you should assign passwords to the accounts created by mysql_install_db. Instructions for doing so are given in Section, “Securing the Initial MySQL Accounts”.

In the examples shown here, the server runs under the user ID of the mysql login account. This assumes that such an account exists. Either create the account if it does not exist, or substitute the name of a different existing login account that you plan to use for running the server.

  1. Change location into the top-level directory of your MySQL installation, represented here by BASEDIR:

    shell> cd BASEDIR

    BASEDIR is likely to be something like /usr/local/mysql or /usr/local. The following steps assume that you are located in this directory.

  2. If necessary, run the mysql_install_db program to set up the initial MySQL grant tables containing the privileges that determine how users are allowed to connect to the server. You'll need to do this if you used a distribution type for which the installation procedure doesn't run the program for you.

    Typically, mysql_install_db needs to be run only the first time you install MySQL, so you can skip this step if you are upgrading an existing installation, However, mysql_install_db does not overwrite any existing privilege tables, so it should be safe to run in any circumstances.

    To initialize the grant tables, use one of the following commands, depending on whether mysql_install_db is located in the bin or scripts directory:

    shell> bin/mysql_install_db --user=mysql
    shell> scripts/mysql_install_db --user=mysql

    The mysql_install_db script creates the server's data directory. Under the data directory, it creates directories for the mysql database that holds all database privileges and the test database that you can use to test MySQL. The script also creates privilege table entries for root and anonymous-user accounts. The accounts have no passwords initially. A description of their initial privileges is given in Section, “Securing the Initial MySQL Accounts”. Briefly, these privileges allow the MySQL root user to do anything, and allow anybody to create or use databases with a name of test or starting with test_.

    It is important to make sure that the database directories and files are owned by the mysql login account so that the server has read and write access to them when you run it later. To ensure this, the --user option should be used as shown if you run mysql_install_db as root. Otherwise, you should execute the script while logged in as mysql, in which case you can omit the --user option from the command.

    mysql_install_db creates several tables in the mysql database, including user, db, host, tables_priv, columns_priv, func, and others. See Section 5.4, “The MySQL Access Privilege System”, for a complete listing and description of these tables.

    If you don't want to have the test database, you can remove it with mysqladmin -u root drop test after starting the server.

    If you have trouble with mysql_install_db at this point, see Section, “Problems Running mysql_install_db.

  3. Start the MySQL server:

    shell> bin/mysqld_safe --user=mysql &

    It is important that the MySQL server be run using an unprivileged (non-root) login account. To ensure this, the --user option should be used as shown if you run mysqld_safe as system root. Otherwise, you should execute the script while logged in to the system as mysql, in which case you can omit the --user option from the command.

    Further instructions for running MySQL as an unprivileged user are given in Section 5.3.5, “How to Run MySQL as a Normal User”.

    If you neglected to create the grant tables before proceeding to this step, the following message appears in the error log file when you start the server:

    mysqld: Can't find file: 'host.frm'

    If you have other problems starting the server, see Section, “Starting and Troubleshooting the MySQL Server”.

  4. Use mysqladmin to verify that the server is running. The following commands provide simple tests to check whether the server is up and responding to connections:

    shell> bin/mysqladmin version
    shell> bin/mysqladmin variables

    The output from mysqladmin version varies slightly depending on your platform and version of MySQL, but should be similar to that shown here:

    shell> bin/mysqladmin version
    mysqladmin Ver 14.12 Distrib 5.0.56, for pc-linux-gnu on i686
    Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
    This software comes with ABSOLUTELY NO WARRANTY. This is free software,
    and you are welcome to modify and redistribute it under the GPL license

    Server version 5.0.56
    Protocol version 10
    Connection Localhost via UNIX socket
    UNIX socket /var/lib/mysql/mysql.sock
    Uptime: 14 days 5 hours 5 min 21 sec

    Threads: 1 Questions: 366 Slow queries: 0
    Opens: 0 Flush tables: 1 Open tables: 19
    Queries per second avg: 0.000

    To see what else you can do with mysqladmin, invoke it with the --help option.

  5. Verify that you can shut down the server:

    shell> bin/mysqladmin -u root shutdown
  6. Verify that you can start the server again. Do this by using mysqld_safe or by invoking mysqld directly. For example:

    shell> bin/mysqld_safe --user=mysql --log &

    If mysqld_safe fails, see Section, “Starting and Troubleshooting the MySQL Server”.

  7. Run some simple tests to verify that you can retrieve information from the server. The output should be similar to what is shown here:

    shell> bin/mysqlshow
    | Databases |
    | mysql |
    | test |

    shell> bin/mysqlshow mysql
    Database: mysql
    | Tables |
    | columns_priv |
    | db |
    | func |
    | help_category |
    | help_keyword |
    | help_relation |
    | help_topic |
    | host |
    | proc |
    | procs_priv |
    | tables_priv |
    | time_zone |
    | time_zone_leap_second |
    | time_zone_name |
    | time_zone_transition |
    | time_zone_transition_type |
    | user |

    shell> bin/mysql -e "SELECT Host,Db,User FROM db" mysql
    | host | db | user |
    | % | test | |
    | % | test_% | |
  8. There is a benchmark suite in the sql-bench directory (under the MySQL installation directory) that you can use to compare how MySQL performs on different platforms. The benchmark suite is written in Perl. It requires the Perl DBI module that provides a database-independent interface to the various databases, and some other additional Perl modules:


    These modules can be obtained from CPAN ( See also Section, “Installing Perl on Unix”.

    The sql-bench/Results directory contains the results from many runs against different databases and platforms. To run all tests, execute these commands:

    shell> cd sql-bench
    shell> perl run-all-tests

    If you don't have the sql-bench directory, you probably installed MySQL using RPM files other than the source RPM. (The source RPM includes the sql-bench benchmark directory.) In this case, you must first install the benchmark suite before you can use it. There are separate benchmark RPM files named mysql-bench-VERSION.i386.rpm that contain benchmark code and data.

    If you have a source distribution, there are also tests in its tests subdirectory that you can run. For example, to run auto_increment.tst, execute this command from the top-level directory of your source distribution:

    shell> mysql -vvf test < ./tests/auto_increment.tst

    The expected result of the test can be found in the ./tests/auto_increment.res file.

  9. At this point, you should have the server running. However, none of the initial MySQL accounts have a password, so you should assign passwords using the instructions found in Section, “Securing the Initial MySQL Accounts”.

The MySQL 5.0 installation procedure creates time zone tables in the mysql database. However, you must populate the tables manually using the instructions in Section 9.6, “MySQL Server Time Zone Support”. Problems Running mysql_install_db

This section does not apply to MySQL Enterprise Server users.

The purpose of the mysql_install_db script is to generate new MySQL privilege tables. It does not overwrite existing MySQL privilege tables, and it does not affect any other data.

If you want to re-create your privilege tables, first stop the mysqld server if it's running. Then rename the mysql directory under the data directory to save it, and then run mysql_install_db. Suppose that your current directory is the MySQL installation directory and that mysql_install_db is located in the bin directory and the data directory is named data. To rename the mysql database and re-run mysql_install_db, use these commands.

shell> mv data/mysql data/mysql.old
shell> bin/mysql_install_db --user=mysql

When you run mysql_install_db, you might encounter the following problems:

  • mysql_install_db fails to install the grant tables

    You may find that mysql_install_db fails to install the grant tables and terminates after displaying the following messages:

    Starting mysqld daemon with databases from XXXXXX
    mysqld ended

    In this case, you should examine the error log file very carefully. The log should be located in the directory XXXXXX named by the error message and should indicate why mysqld didn't start. If you do not understand what happened, include the log when you post a bug report. See Section 1.7, “How to Report Bugs or Problems”.

  • There is a mysqld process running

    This indicates that the server is running, in which case the grant tables have probably been created already. If so, there is no need to run mysql_install_db at all because it needs to be run only once (when you install MySQL the first time).

  • Installing a second mysqld server does not work when one server is running

    This can happen when you have an existing MySQL installation, but want to put a new installation in a different location. For example, you might have a production installation, but you want to create a second installation for testing purposes. Generally the problem that occurs when you try to run a second server is that it tries to use a network interface that is in use by the first server. In this case, you should see one of the following error messages:

    Can't start server: Bind on TCP/IP port:
    Address already in use
    Can't start server: Bind on unix socket...

    For instructions on setting up multiple servers, see Section 5.6, “Running Multiple MySQL Servers on the Same Machine”.

  • You do not have write access to the /tmp directory

    If you do not have write access to create temporary files or a Unix socket file in the default location (the /tmp directory), an error occurs when you run mysql_install_db or the mysqld server.

    You can specify different locations for the temporary directory and Unix socket file by executing these commands prior to starting mysql_install_db or mysqld, where some_tmp_dir is the full pathname to some directory for which you have write permission:

    shell> TMPDIR=/some_tmp_dir/
    shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysql.sock
    shell> export TMPDIR MYSQL_UNIX_PORT

    Then you should be able to run mysql_install_db and start the server with these commands:

    shell> bin/mysql_install_db --user=mysql
    shell> bin/mysqld_safe --user=mysql &

    If mysql_install_db is located in the scripts directory, modify the first command to scripts/mysql_install_db.

    See Section B.1.4.5, “How to Protect or Change the MySQL Unix Socket File”, and Section 2.4.20, “Environment Variables”.

There are some alternatives to running the mysql_install_db script provided in the MySQL distribution:

  • If you want the initial privileges to be different from the standard defaults, you can modify mysql_install_db before you run it. However, it is preferable to use GRANT and REVOKE to change the privileges after the grant tables have been set up. In other words, you can run mysql_install_db, and then use mysql -u root mysql to connect to the server as the MySQL root user so that you can issue the necessary GRANT and REVOKE statements.

    If you want to install MySQL on several machines with the same privileges, you can put the GRANT and REVOKE statements in a file and execute the file as a script using mysql after running mysql_install_db. For example:

    shell> bin/mysql_install_db --user=mysql
    shell> bin/mysql -u root < your_script_file

    By doing this, you can avoid having to issue the statements manually on each machine.

  • It is possible to re-create the grant tables completely after they have previously been created. You might want to do this if you're just learning how to use GRANT and REVOKE and have made so many modifications after running mysql_install_db that you want to wipe out the tables and start over.

    To re-create the grant tables, remove all the .frm, .MYI, and .MYD files in the mysql database directory. Then run the mysql_install_db script again.

  • You can start mysqld manually using the --skip-grant-tables option and add the privilege information yourself using mysql:

    shell> bin/mysqld_safe --user=mysql --skip-grant-tables &
    shell> bin/mysql mysql

    From mysql, manually execute the SQL commands contained in mysql_install_db. Make sure that you run mysqladmin flush-privileges or mysqladmin reload afterward to tell the server to reload the grant tables.

    Note that by not using mysql_install_db, you not only have to populate the grant tables manually, you also have to create them first. Starting and Stopping MySQL Automatically

Generally, you start the mysqld server in one of these ways:

The mysqld_safe and mysql.server scripts and the Mac OS X Startup Item can be used to start the server manually, or automatically at system startup time. mysql.server and the Startup Item also can be used to stop the server.

To start or stop the server manually using the mysql.server script, invoke it with start or stop arguments:

shell> mysql.server start
shell> mysql.server stop

Before mysql.server starts the server, it changes location to the MySQL installation directory, and then invokes mysqld_safe. If you want the server to run as some specific user, add an appropriate user option to the [mysqld] group of the /etc/my.cnf option file, as shown later in this section. (It is possible that you will need to edit mysql.server if you've installed a binary distribution of MySQL in a non-standard location. Modify it to cd into the proper directory before it runs mysqld_safe. If you do this, your modified version of mysql.server may be overwritten if you upgrade MySQL in the future, so you should make a copy of your edited version that you can reinstall.)

mysql.server stop stops the server by sending a signal to it. You can also stop the server manually by executing mysqladmin shutdown.

To start and stop MySQL automatically on your server, you need to add start and stop commands to the appropriate places in your /etc/rc\* files.

If you use the Linux server RPM package (MySQL-server-VERSION.rpm), the mysql.server script is installed in the /etc/init.d directory with the name mysql. You need not install it manually. See Section 2.4.9, “Installing MySQL from RPM Packages on Linux”, for more information on the Linux RPM packages.

Some vendors provide RPM packages that install a startup script under a different name such as mysqld.

If you install MySQL from a source distribution or using a binary distribution format that does not install mysql.server automatically, you can install it manually. The script can be found in the support-files directory under the MySQL installation directory or in a MySQL source tree.

To install mysql.server manually, copy it to the /etc/init.d directory with the name mysql, and then make it executable. Do this by changing location into the appropriate directory where mysql.server is located and executing these commands:

shell> cp mysql.server /etc/init.d/mysql
shell> chmod +x /etc/init.d/mysql

Older Red Hat systems use the /etc/rc.d/init.d directory rather than /etc/init.d. Adjust the preceding commands accordingly. Alternatively, first create /etc/init.d as a symbolic link that points to /etc/rc.d/init.d:

shell> cd /etc
shell> ln -s rc.d/init.d .

After installing the script, the commands needed to activate it to run at system startup depend on your operating system. On Linux, you can use chkconfig:

shell> chkconfig --add mysql

On some Linux systems, the following command also seems to be necessary to fully enable the mysql script:

shell> chkconfig --level 345 mysql on

On FreeBSD, startup scripts generally should go in /usr/local/etc/rc.d/. The rc(8) manual page states that scripts in this directory are executed only if their basename matches the \*.sh shell filename pattern. Any other files or directories present within the directory are silently ignored. In other words, on FreeBSD, you should install the mysql.server script as /usr/local/etc/rc.d/ to enable automatic startup.

As an alternative to the preceding setup, some operating systems also use /etc/rc.local or /etc/init.d/boot.local to start additional services on startup. To start up MySQL using this method, you could append a command like the one following to the appropriate startup file:

/bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &'

For other systems, consult your operating system documentation to see how to install startup scripts.

You can add options for mysql.server in a global /etc/my.cnf file. A typical /etc/my.cnf file might look like this:



The mysql.server script understands the following options: basedir, datadir, and pid-file. If specified, they must be placed in an option file, not on the command line. mysql.server understands only start and stop as command-line arguments.

The following table shows which option groups the server and each startup script read from option files:

Script Option Groups
mysqld [mysqld], [server], [mysqld-major_version]
mysqld_safe [mysqld], [server], [mysqld_safe]
mysql.server [mysqld], [mysql.server], [server]

[mysqld-major_version] means that groups with names like [mysqld-4.1] and [mysqld-5.0] are read by servers having versions 4.1.x, 5.0.x, and so forth. This feature can be used to specify options that can be read only by servers within a given release series.

For backward compatibility, mysql.server also reads the [mysql_server] group and mysqld_safe also reads the [safe_mysqld] group. However, you should update your option files to use the [mysql.server] and [mysqld_safe] groups instead when using MySQL 5.0.

See Section, “Using Option Files”. Starting and Troubleshooting the MySQL Server

This section provides troubleshooting suggestions for problems starting the server on Unix. If you are using Windows, see Section, “Troubleshooting a MySQL Installation Under Windows”.

If you have problems starting the server, here are some things to try:

  • Check the error log to see why the server does not start.

  • Specify any special options needed by the storage engines you are using.

  • Make sure that the server knows where to find the data directory.

  • Make sure that the server can access the data directory. The ownership and permissions of the data directory and its contents must be set such that the server can read and modify them.

  • Verify that the network interfaces the server wants to use are available.

Some storage engines have options that control their behavior. You can create a my.cnf file and specify startup options for the engines that you plan to use. If you are going to use storage engines that support transactional tables (InnoDB, BDB, NDB), be sure that you have them configured the way you want before starting the server:

MySQL Enterprise.  For expert advice on start-up options appropriate to your circumstances, subscribe to The MySQL Enterprise Monitor. For more information see,

Storage engines will use default option values if you specify none, but it is recommended that you review the available options and specify explicit values for those for which the defaults are not appropriate for your installation.

When the mysqld server starts, it changes location to the data directory. This is where it expects to find databases and where it expects to write log files. The server also writes the pid (process ID) file in the data directory.

The data directory location is hardwired in when the server is compiled. This is where the server looks for the data directory by default. If the data directory is located somewhere else on your system, the server will not work properly. You can determine what the default path settings are by invoking mysqld with the --verbose and --help options.

If the default locations don't match the MySQL installation layout on your system, you can override them by specifying options to mysqld or mysqld_safe on the command line or in an option file.

To specify the location of the data directory explicitly, use the --datadir option. However, normally you can tell mysqld the location of the base directory under which MySQL is installed and it looks for the data directory there. You can do this with the --basedir option.

To check the effect of specifying path options, invoke mysqld with those options followed by the --verbose and --help options. For example, if you change location into the directory where mysqld is installed and then run the following command, it shows the effect of starting the server with a base directory of /usr/local:

shell> ./mysqld --basedir=/usr/local --verbose --help

You can specify other options such as --datadir as well, but --verbose and --help must be the last options.

Once you determine the path settings you want, start the server without --verbose and --help.

If mysqld is currently running, you can find out what path settings it is using by executing this command:

shell> mysqladmin variables


shell> mysqladmin -h host_name variables

host_name is the name of the MySQL server host.

If you get Errcode 13 (which means Permission denied) when starting mysqld, this means that the privileges of the data directory or its contents do not allow the server access. In this case, you change the permissions for the involved files and directories so that the server has the right to use them. You can also start the server as root, but this raises security issues and should be avoided.

On Unix, change location into the data directory and check the ownership of the data directory and its contents to make sure the server has access. For example, if the data directory is /usr/local/mysql/var, use this command:

shell> ls -la /usr/local/mysql/var

If the data directory or its files or subdirectories are not owned by the login account that you use for running the server, change their ownership to that account. If the account is named mysql, use these commands:

shell> chown -R mysql /usr/local/mysql/var
shell> chgrp -R mysql /usr/local/mysql/var

If the server fails to start up correctly, check the error log. Log files are located in the data directory (typically C:\\Program Files\\MySQL\\MySQL Server 5.0\\data on Windows, /usr/local/mysql/data for a Unix binary distribution, and /usr/local/var for a Unix source distribution). Look in the data directory for files with names of the form host_name.err and host_name.log, where host_name is the name of your server host. Then examine the last few lines of these files. On Unix, you can use tail to display them:

shell> tail host_name.err
shell> tail host_name.log

The error log should contain information that indicates why the server couldn't start. For example, you might see something like this in the log:

000729 14:50:10  bdb:  Recovery function for LSN 1 27595 failed
000729 14:50:10 bdb: warning: ./test/t1.db: No such file or directory
000729 14:50:10 Can't init databases

This means that you did not start mysqld with the --bdb-no-recover option and Berkeley DB found something wrong with its own log files when it tried to recover your databases. To be able to continue, you should move the old Berkeley DB log files from the database directory to some other place, where you can later examine them. The BDB log files are named in sequence beginning with log.0000000001, where the number increases over time.

If you are running mysqld with BDB table support and mysqld dumps core at startup, this could be due to problems with the BDB recovery log. In this case, you can try starting mysqld with --bdb-no-recover. If that helps, you should remove all BDB log files from the data directory and try starting mysqld again without the --bdb-no-recover option.

If either of the following errors occur, it means that some other program (perhaps another mysqld server) is using the TCP/IP port or Unix socket file that mysqld is trying to use:

Can't start server: Bind on TCP/IP port: Address already in use
Can't start server: Bind on unix socket...

Use ps to determine whether you have another mysqld server running. If so, shut down the server before starting mysqld again. (If another server is running, and you really want to run multiple servers, you can find information about how to do so in Section 5.6, “Running Multiple MySQL Servers on the Same Machine”.)

If no other server is running, try to execute the command telnet your_host_name tcp_ip_port_number. (The default MySQL port number is 3306.) Then press Enter a couple of times. If you don't get an error message like telnet: Unable to connect to remote host: Connection refused, some other program is using the TCP/IP port that mysqld is trying to use. You'll need to track down what program this is and disable it, or else tell mysqld to listen to a different port with the --port option. In this case, you'll also need to specify the port number for client programs when connecting to the server via TCP/IP.

Another reason the port might be inaccessible is that you have a firewall running that blocks connections to it. If so, modify the firewall settings to allow access to the port.

If the server starts but you can't connect to it, you should make sure that you have an entry in /etc/hosts that looks like this:       localhost

This problem occurs only on systems that do not have a working thread library and for which MySQL must be configured to use MIT-pthreads.

If you cannot get mysqld to start, you can try to make a trace file to find the problem by using the --debug option. See MySQL Internals: Porting.


Thursday Mar 20, 2008

What Everyone Should Know about Open Source

Monday Mar 03, 2008

XPath : Finding GUI element by matching multiple text(s) pattern of a attribute value

Recently i had to spend my whole day searching for ways to find a elements' XPath (a ajax based button) by matching multiple text pattern within a single attribute value. I was using Selenium IDE to automate testing of Sun Portal Server GUI which is based on Ajax.

My Requirement : Uniquely Identify a ajax based button having the below XPath



My Problem : Attribute(@id) value has both constant and dynamic texts which makes it difficult to uniquely identify the element based on its value

If you look at my ajax button's xpath , there is a numeral "81533739" which is not constant and it changes everytime but the first part(ccd_ccd_) and the second part(_removeevent) of the @id value is constant . I want to uniquely identify @id attribute based on these constant text alone

Solution:The below xpath will uniquely identify my element using concat() and contains() XPath methods

//a[contains(@id,concat("ccd","_","ccd","_")) and contains(@id,"removeevent")]


Below are few links which i found helpful for this solution:

Monday Jan 21, 2008

Defining Model Based Testing

I will write down some of the definitions of a model based testing found while searching in google:

"Model-based testing, uses algorithms to determine all of the usage paths for an application, pares down that number for maximum coverage and minimal testing, and then generates various test cases to try the application against" .. [Original Article]

Sun Portal Server Installation failure Troubleshooting

After Portal Server Installation , if you are getting problems accessing /portal then check for whether the installation itself has successfully completed or not. Here I will cover up some of the typical cases which will indicate that the installation was not successful.

Case I : After portal server installation, the ps console comes up fine , the web server(container) comes up. However, the /portal does not come up

While the container startsup, the below message indicates that the portal was not deployed properly.

[21/Jan/2008:19:09:00] failure (22091): WebModule[/portal]PWC1275: Exception sending context initialized event to listener instance of class
Caused by: java.lang.RuntimeException: failed to get properties
    ... 14 more
Caused by: /opt/SUNWportal/lib/ (No such file or directory)

More installation and portal configuration related info can be found in portal fabric and admin logs
Relevant logs are /var/opt/SUNWportal/logs/fabric/portal.fabric.0.0 and /var/opt/SUNWportal/logs/admin/portal.0.0.0


Sunday Jan 20, 2008

Removing Terminal Color display in Linux

I regularly use putty terminal client from my windows machine to connect to Linux systems in the lab. One of the annoying thing is that when i do a "ls" command i get to see the directory files all colored , so intense that i wont be able to see the output . One way of solving this problem is to run the command "unalias ls".

Read more about the solution here


Model Based Testing of Web Applications

This blog might come in handy for Quality/Test Engineer who is new to Model Based Testing concepts. Please note that this is a living blog and i will update then and there i find good links about Model Based Testing esp. that of Web Applications

[1] IBM's Article on Model Based Testing (with a web based application example)

Tuesday Oct 30, 2007

Selenium: Coding Standards for Selenium Core Test Tool

Selenium Core project has some agreed upon standards for developing your test scripts. Below is as is from their Readme.txt file


   Coding standards for Selenium Core Javascript code

  Here is a set of conventions agreed by the active Selenium Core
  developers at ThoughtWorks.  Please stick to these guidelines when
  working on the Selenium Core code-base.
  • Whitespace: we use spaces, NOT TABS.  Indent in 4-space increments.
  • Braces: we place open-braces on the same line as the associated keyword,  for example:
        if (command.isBreakpoint) {
        } else {
            window.setTimeout(this.resume.bind(this), delay);
  • Encapsulation: we prefer to encapsulate functions and variables inside objects, where possible.
  • Variable declarations: declare variables (using "var") ... even if they're "global".
  • Class definitions: we're shifting to "prototype.js" style for definition of classes, e.g.
        var MyClass = Class.create();
        Object.extend(MyClass.prototype, {
            initialize: function() {
                // ... constructor code ...
            doStuff: function() {
                // ... method body ...
  • 'Private' functions/properties: we simulate "private" properties by  prepended the name with an underscore ("_"), e.g.
        _resumeAfterDelay : function() {
            // ...etc...
  • Element addressing: use "$(id)" rather than "document.getElementById('id')".
  • Timeout functions: pass function objects to setTimeout(), rather thanstrings, e.g. window.setTimeout(this.resume.bind(this), delay);


I'm a Quality Engineer at Sun Microsystems. Here in this blog, you may find information about Software Testing, Portal Server, Virtualization, Web2.0 and Misc Technical topics. The views expressed here are personal and does not reflect that of my employer


« December 2016