Sunday, November 23, 2014

When installing mysql in linux, why do we create a mysql group and user?



Every process under linux runs under specific user privileges. Services (like MySQL) usually need to open ports and access various system resources during startup, so they are required to be started as root user.

However, it is not safe to have all the processes run under root as it is not required for continuous operation of services, thus it is recommended to create a special user, which will be used to run MySQL service.

MySQL will only be able to access what special user can, and this is going to be limited to MySQL files on the system.

This is usual practice in linux.





If you enjoyed this post, make sure you subscribe to my RSS feed! Comments are encouraged

Friday, November 21, 2014

cache_rules Errors in Drupal Websites

While building an E-Commerce website, I've encountered the following error


PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydatabasename.cache_rules' doesn't exist: TRUNCATE {cache_rules} ; Array ( ) in cache_clear_all() (line 167 of C:\Users\globalsoftbay\Sites\devdesktop\mywebsitename\includes\cache.inc). "


Let's see how to solve this.

The above error occurs genrally when the cache_rules table/view is corrupt.



The easier way is to truncate the table without dtopping so that we don't need to create it again. But when I went to my phpmyadmin and clicked on this view, I received the following error.

" #1146 - Table 'mydatabasename.cache_field' doesn't exist "


So, now the solution is to drop it and create using same structure.

Execute the following SQL code and get it done. :)

  1. drop TABLE cache_rules;
  2. CREATE TABLE IF NOT EXISTS `cache_rules` (
  `cid` varchar(255) NOT NULL DEFAULT '' COMMENT 'Primary Key: Unique cache ID.',
  `data` longblob COMMENT 'A collection of data to cache.',
  `expire` int(11) NOT NULL DEFAULT '0' COMMENT 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
  `created` int(11) NOT NULL DEFAULT '0' COMMENT 'A Unix timestamp indicating when the cache entry was created.',
  `serialized` smallint(6) NOT NULL DEFAULT '0' COMMENT 'A flag to indicate whether content is serialized (1) or not (0).',
  PRIMARY KEY (`cid`),
  KEY `expire` (`expire`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Cache table for the rules engine to store configured items.';

Refresh the page with error. If the error is gone, fine :) But my case is complex. I received one more error. Below is the same.

PDOException: SQLSTATE[HY000]: General error: 1030 Got error -1 from storage engine: TRUNCATE {cache_rules} ; Array ( ) in cache_clear_all() (line 167 of C:\Users\globalsoftbay\Sites\devdesktop\mywebsitename\includes\cache.inc). "

For fixing this, I followed this procedure.


If you enjoyed this post, make sure you subscribe to my RSS feed! Comments are encouraged

cache_field Errors in Drupal Websites

While building an E-Commerce website, I've encountered the following error


" PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydatabasename.cache_field' doesn't exist: DELETE FROM {cache_field} WHERE (cid LIKE :db_condition_placeholder_0 ESCAPE '\\') ; Array ( [:db_condition_placeholder_0] => field\_info\_types:% ) in cache_clear_all() (line 167 of C:\Users\globalsoftbay\Sites\devdesktop\mywebsitename\includes\cache.inc). "


Let's see how to solve this.

The above error occurs genrally when the cache_field table/view is corrupt.



The easier way is to truncate the table without dtopping so that we don't need to create it again. But when I went to my phpmyadmin and clicked on this view, I received the following error.

" #1146 - Table 'mydatabasename.cache_field' doesn't exist "


So, now the solution is to drop it and create using same structure.

Execute the following SQL code and get it done. :)

  1. drop TABLE `cache_field`;
  2. CREATE TABLE IF NOT EXISTS `cache_field` (
        `cid` varchar(255) NOT NULL DEFAULT '' COMMENT 'Primary Key: Unique cache ID.',
        `data` longblob COMMENT 'A collection of data to cache.',
        `expire` int(11) NOT NULL DEFAULT '0' COMMENT 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
        `created` int(11) NOT NULL DEFAULT '0' COMMENT 'A Unix timestamp indicating when the cache entry was created.',
        `serialized` smallint(6) NOT NULL DEFAULT '0' COMMENT 'A flag to indicate whether content is serialized (1) or not (0).',
        PRIMARY KEY (`cid`),
        KEY `expire` (`expire`)
        )
        ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Generic cache table for caching things not separated out...';
Refresh the page with error. If the error is gone, fine :) But my case is complex. I received one more error. Below is the same

" PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydatabasename.cache_rules' doesn't exist: TRUNCATE {cache_rules} ; Array ( ) in cache_clear_all() (line 167 of C:\Users\globalsoftbay\Sites\devdesktop\mywebsitename\includes\cache.inc). "

For fixing this, I followed this procedure.



If you enjoyed this post, make sure you subscribe to my RSS feed! Comments are encouraged

[How to] upgrade a drupal site


  1. Backup Website files and Database
  2. Download latest version of drupal
  3. Extract the latest drupal and copy all those files and folders into existing website folder except sites/ folder
  4. Replace the existing files when asked
  5. Go to website.com/update.php 
  6. Proceed with the instructions






If you enjoyed this post, make sure you subscribe to my RSS feed! Comments are encouraged

Saturday, November 15, 2014

Drupal Commerce Installation


  1. WAMP server may not work well with Drupal Commerce causing Webpage not available kind of problems. 
  2. Better go to Acquia Dev Desktop from here and install. 
  3. After installing Acquia Desktop, it asks to choose one of the CMS's available in there. Choose Drupal Commerce
  4. Select latest PHP when asked.
  5. Launch the URL given by AD (Acquia Dev Desktop)
  6. Drupal Commerce Welcome screen appears in web browser
  7. Check I agree to the Privacy Policy and User Agreement radio button and proceed with Let's get started
  8. It verifies requirements, Sets up Database and installs Commerce KickStart 2
  9. Requirements problems:
    1. PHP memory limit 90M: Consider increasing your PHP memory limit to 128M to help prevent errors in the installation process. This problem can be solved by this link or raise a support ticket for the same if on web hosting.
  10. Installation takes a bit of time.





If you enjoyed this post, make sure you subscribe to my RSS feed! Comments are encouraged