Connecting to the MySQL Server using MySQL client program

Connnect

For connecting to the MySQL server you need to use MySQL client program. It needs to be provided parameters such as the hostname, username, password etc. to connect to the MySQL Server; if no parameters are specified the default values are assumed. Any of the connection parameters can be specified to override the default values.

Connecting to a local server specifying username and password

# mysql --user=username --password=mypassword databasename;
# mysql -u username -pmypassword databasename;

Continue reading »

Setting user account passwords in MySQL

Password

It is important to have passwords for all MySQL user accounts for securing the database. If anyone knows the username of an account with no password then he can successfully connect to the database server.

To assign or change a password for an existing account

mysql> SET PASSWORD FOR 'newuser'@'localhost' = PASSWORD('mypass');

NOTE: Only users such as root that have update access to the mysql database can change the password for other users.

Continue reading »

Deleting user accounts in MySQL

User

The DROP USER statement is used to delete MySQL accounts and their privileges.

DROP USER 'accountuser'@'localhost';

If you wish to delete multiple user accounts then you can enter them comma separated as shown below:

DROP USER 'accountuser1'@'localhost', DROP USER 'accountuser2'@'localhost';

Continue reading »

Changing the “Position” text to “Default” in the “Sort By” dropdown on product listing page in Magento

Magento

In Magento Vanilla installation the products are sorted based on “Position” on the product listing page by default. You have the provision to configure the default sorting parameter from Magento admin. In Magento Vanilla installation admin the options available are – “Best Value”, “Name” and “Price”. “Best Value” sorting is actually sorting by position.

“name” and “price” are catalog attributes but “position” is not.

If in case you need to remove sorting by position then you will have to override the Catalog module model but if just you need to change the text then you can do it with the help of locale files.

Continue reading »

Creating user accounts in MySQL

User

MySQL user names can be up to 16 characters long.

Here are the queries for creating user accounts in MySQL:

Create user with no password

mysql> CREATE USER 'newuser'@'localhost';

Create user with password test123

mysql> CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'test123';

Continue reading »

How to change the default sorting on product listing page in Magento?

Listing

In Magento you can change the default sorting attribute for product listing page from Magento admin.

To set the sorting attribute login to Magento admin and follow the following steps:

1. Go to Admin >> System >> Configuration >> Catalog
2. Expand the “Frontend” Section
3. Make selection from the “Product Listing Sort by” dropdown
4. Click the “Save Config” button.

Continue reading »

How to limit the number of characters that can be entered in a textarea or input field?

Edit Text

In web pages which take input/feedback from the customers it’s a good idea to limit the type and size of data that can be entered so that spam can be avoided.

Let see how we can limit the number of characters that can be entered in a text box.

The simplest approach I follow is to use the jQuery “Limit” plugin. Click here to download the plugin.

Continue reading »

How to set/change the position of products in product listing page in Magento?

Sorting

In order to promote certain products, you may want to place them at the top in the category product listing page. Lets see how to set/change the position of the products from Magento admin.

To set/change the position of the products proceed as below:

1. Login Magento admin and follow the path Admin >> Catalog >> Manage Categories.
2. Click on a category in the category tree to display the category related information.

Continue reading »

Securing Solr Admin Interface on Tomcat

Apache Solr

Solr admin interface provides information about the solr and its running environment, provides the power to manage cores, view the logs etc. It is open to public by default hence a security risk, lets see how we can password protect the solr admin.

The steps mentioned have been tried in a hosting environment which has the following software installed.

  • apache-tomcat-7.0.55
  • jdk1.7.0_65
  • solr-4.10.0
  • CentOS 6.5

Continue reading »

How to change the “Reply” text in the comments listing and add a custom css class to the “Reply” link?

Wordpress

If you open the comments.php template file and look at the source code you will find that “wp_list_comments” function is used to display the comments listing. To change the “Reply” text your can pass “reply_text” parameter to “wp_list_comments” function.

Similarly to customize the comments listing frontend design you can pass a callback function as parameter to “wp_list_comments” function.

Continue reading »

Back to top