MySql

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. Continue Reading…

Share

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

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

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

MySQL – Steps for Better SQL Performance

Steps to make MySQL produce optimized results

» Identify the queries that execute slowly
» Watch for Opened Sql connections
» Carry benchmark test on Queries
» Execute queries with Explain statement to the performance of each queries
Continue Reading…

Share

windows command prompt mysql start stop

To start MySQL service from Windows command prompt

c:\mysql\bin> net start mysql

To stop MySQL service from Windows command prompt

c:\mysql\bin> net stop mysql

Share

MySQL vs. PostgreSQL – Comparison

There had often been talks and some times flame wars when there had been comparison between MySQL and PostgreSQL. Each database has its own strength and weaknesses. As an initiative, I thought to do a little research on this topic and to list down the common points gathered in a tabular format. Continue Reading…

Share

MySQL database optimisation series – Right MySQL Data type

Numeric Data type in MySQL

Choosing the right data type can create significant improvement in application performance.

Many programmers/developers who opt to choose MySQL as the backend for their operations often fail miserably in choosing the most efficient data types. Continue Reading…

Share

phpMyAdmin – visual interface for MySQL on Windows/Linux

phpMyAdmin is a web based interface to MySQL which is written using PHP for Administration of databases. Visual interface provided is intuitive and it saves time for the developers. (ver 3.1.1 is the recommended version as of this writing which runs on PHP 5/MySQL 5)

Step 1: First we need to check MySQL is installed by issuing the following command
[root@user Desktop]# which mysql

If you get …
/usr/bin/mysql
then, it is an indication that MySQL is installed in your machine. Continue Reading…

Share
Kurinchi Calendar
September 2018
M T W T F S S
« Oct    
 12
3456789
10111213141516
17181920212223
24252627282930