Archive for the ‘MySql’ Category

May
15
2009

MySQL – MyISAM, BSD, InnoDB Considerations

MySQL Table Types that are well known
- MyISAM
- InnoDB
- BSD

When making a choice amongst the different types of tables in MySQL, we need to consider the following points

- Size of database based on the activity
- Nature of database access / activity (whether it involves heavy reads / writes)
- Database backup (schema, data)
- Session handling
- If it involves a sync to another database
- What needs to be done if the application is to be scaled
(more…)

  • Share/Save/Bookmark
May
05
2009

Install MySQL on Ubuntu

Steps to install MySQL on Ubuntu Server

After setting up the server, issue the below command to install mysql and its associated libraries

$ apt-get install mysql-server mysql-client libmysqlclient12-dev

Edit MySQL configuration file, to set the IP address that will be dedicated for MySQL.
(more…)

  • Share/Save/Bookmark
Apr
15
2009

MySQL Create User Grant Rights

User creation in MySQL is a simple process. when a “user” is created in MySQL a record gets entered in the DB “mysql” under table “user”. To create a user you need to have the user creation rights or the super user rights. When MySQL is initially installed, root account is created in the database by default with no password to that account. As the root account has all the privileges in the MySQL server, it is advisable to create separate user account(s) for each database.

(more…)

  • Share/Save/Bookmark
Apr
06
2009

Transfer larger files in email – zip, split, unzip

How to transfer mysql backup files across network or emails?

Say for example, you generate a mysql dump called “mysql.dump” from your database the size of which is beyond the file transferable limit of your email account. The following steps will help you in making the file transfer possible (more…)

  • Share/Save/Bookmark
Mar
06
2009

MySQL Case Sensitivity

Is MySQL Case-Sensitive?
The SQL syntax is NOT case-sensitive in MySQL.

If the application written in PHP/Perl or other languages were to be used in Microsoft & Linux environment, then it would really be an issue for the database administrators and for the programmers.

That is the reason why you might have noticed books or sites saying that it is always recommended to treat MySQL syntax as being case-sensitive.

It was interesting to learn that the database name remains case sensitive.

  • Share/Save/Bookmark
Feb
22
2009

MySQL – What is Character set and Collation?

As given by MySQL documentation (http://dev.mysql.com/doc/refman/4.1/en/charset-general.html): A character set is a set of symbols and encodings. A collation is a set of rules for comparing characters in a character set.

Why is MySQL Collation an important consideration?
Collation determines the rules in comparing characters including the case sensitiveness, accent sensitiveness, trailing space sensitiveness of the character set. (more…)

  • Share/Save/Bookmark
Feb
13
2009

MySql Tip for Beginners – Import records from .csv from Command line

Importing a .CSV file in MySQL from command line.

When you want to import records from a .csv file into a table, follow the steps given below:

[root@localhost]$ mysql -u [username] -p [password]

[root@localhost]$ use [my_database]

[root@localhost]$ LOAD DATA LOCAL INFILE ‘userinfo.csv’ INTO TABLE [table name] FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\n’;

This should be the same command that get executed on windows command prompt as well.

  • Share/Save/Bookmark
Feb
12
2009

MySql Tip for Beginners – Export records to .csv from Command line

Exporting a .CSV file based on user requirement is very easy in MySQL.

A simple query could generate your desired output as .CSV file. Let’s see what that command is

[root@localhost]$ mysql -u [username] -p [password]

[root@localhost]$ use [my_database]

[root@localhost]$ SELECT * INTO OUTFILE ‘/userinfo.csv’ FIELDS TERMINATED BY ‘,’ OPTIONALLY ENCLOSED BY ‘”" ESCAPED BY ‘\\’ LINES TERMINATED BY ‘\n’ FROM Table_Users;

Voila! You have your desired results in as a .csv file.

In the next article, we will discuss on how we can import data from .csv file back into database.

  • Share/Save/Bookmark
Feb
10
2009

How to shutdown Mysql from command prompt?

To shutdown mysql from command prompt, issue the following command in Linux box

[root@computer /]# mysqladmin -u root -p shutdown

In windows,

C:\mysql\bin> mysqladmin -u root -p shutdown _

  • Share/Save/Bookmark