Home » Archive

Articles in the MySQL Category

Database, MySQL »

[4 Apr 2016 | Comments Off on MySQL: Get size of all databases and tables]

This article shows SQL query to get size (in MB) of all MySQL databases. It also shows the query to get the size (in MB) of all the tables present in any particular database.
Get size (in MB) of all MySQL databases

Linux, MySQL, PHP, Ubuntu »

[3 Dec 2012 | One Comment]

Here are step-by-step commands about installing apache, php, mysql, and phpmyadmin on ubuntu.
1) Open Terminal
– Press:
CTRL + ALT + T

Database, MySQL »

[7 Feb 2012 | Comments Off on Alter MySQL table to add & drop column & add Foreign Key]

This article shows:-

– How to add column to mysql database table after the table has already been created
– How to delete column from mysql database table after the table has already been created

Database, MySQL »

[18 Jul 2011 | 3 Comments]

Some definitions of foreign key:-
A FOREIGN KEY in one table points to a PRIMARY KEY in another table.
A foreign key is a field in a relational table that matches the primary key of another table. The foreign key can be used to cross-reference tables. A table may have multiple foreign keys, and each foreign key can have a different referenced table.

Database, MySQL, SQL »

[15 May 2010 | 2 Comments]

The JOIN keyword is used in an SQL statement to query data from two or more tables, based on a relationship between certain columns in these tables. [@via w3schools]
A SQL JOIN clause combines records from two or more tables in a database. It creates a set that can be saved as a table or used as is. A JOIN is a means for combining fields from two tables by using values common to each. ANSI standard SQL specifies four types of JOINs: INNER, OUTER, LEFT, and RIGHT. In special cases, …

Magento, MySQL »

[31 Dec 2009 | 20 Comments]

Suppose, you have a product collection and you want to filter it by category. Suppose, you want to filter it by more than one category. You can use addCategoryFilter if you have only one category. But, what if you want to filter by more than one category?
Category ids are stored for product in a comma separated way. So, to filter product collection by more than one category, you have to use:
addAttributeToFilter(‘category_ids’,array(‘finset’=>$categoryIds));

MySQL, PHP »

[5 Mar 2008 | 41 Comments]

In this article, I will be presenting simple PHP & MySQL code to add, edit, delete and view data. This kind of system is also referred to CRUD (Create, Read, Update, Delete).
Here is a step-by-step guide on creating a CRUD system using PHP & MySQL:

MySQL, PHP »

[8 Dec 2007 | 31 Comments]

In another article, I have written about Very Simple Add, Edit, Delete, View in PHP & MySQL. That article contains a basic CRUD (Create, Read, Update, Delete) system. It doesn’t have the feature of login and register.
In this article, I will be presenting a complete CRUD system containing login and register feature. User should register himself first. And then he can add data after logging in.

Database, MySQL »

[10 Oct 2007 | Comments Off on MySQL: Backup and Restore database & table]

This article shows how to backup and restore single & multiple databases and tables in MySQL.
1) Backup single database
mysqldump -h hostname –u username –p password database_name > /path/backup.sql

MySQL »

[20 Aug 2007 | Comments Off on MySQL Installation Problem: Can’t create pid file – no such file or directory]

Problem: can’t create pid file: no such file or directory
I had this problem and had a very tough and frustrating time with it. While I was installing a fresh copy of MySQL 5 in Windows XP, I got this problem. (I was installing it from the installer i.e. setup file.) The server was not starting and ‘error 0’ was displayed. I tried to start the server from the command line by typing “mysqld-nt –console” and then got the error “can’t create pid file: no such file or directory“. It was …