MySQL introduction

MySQL is a quick, simple to-use relational database management system (RDBMS) being utilized for some little and huge organizations. MySQL is produced, advertised, and upheld by MySQL AB, which is a Swedish organization. MySQL is turning out to be so well known as a result of multifold great reasons: MySQL is discharged under an open-source permit. So we don't have anything to pay to utilize it. MySQL is an acute project in its own privilege. It handles a huge subset of the usefulness of the most costly and intense database bundles. MySQL utilizes a standard type of the surely understood SQL information dialect. MySQL chips away at numerous working frameworks and with numerous languages including PHP, PERL, C, C++, JAVA, and so forth. MySQL works rapidly and functions admirably even with substantial information sets. MySQL is amicable to PHP, the most refreshing language for web improvement. MySQL underpins expansive databases, up to 50 million lines or more in a table. The default document size point of confinement for a table is 4GB, yet we can build this to a hypothetical breaking point of 8 million terabytes (TB). MySQL is open source and free to download under the GNU General Public License for developers to adjust the MySQL programming to fit their own particular surroundings.

History of MySQL

MySQL was created by MySQL AB, a company founded in 1995 in Sweden. In 2008, MySQL AB announced that it had settled to be attained by Sun Microsystems for $1 billion.

Below are the keywords for MySQL journey years from beginning to till now:

1995-2000 year: The MySQL project was started by Michael Widenius (Monty), David Axmark and Allan Larsson. It was commercially signified by TCX for the first 6 years. MySQL goes Open Source and releases software according to the terms of the GPL. Its Profits dropped by 80% as a result, and it took a year to make up for it.

2001-2005 year: Marten was the CEO of a number of Nordic companies before joining MySQL, and comes with a sales and marketing background. That year 2 million active installations were done on MySQL. MySQL AB entered into a partnership with SAP in 2003. Several features in MySQL 5 were produced with SAP in mind. With the main revenue come from the OEM dual-licensing model, MySQL chooses to move more into the enterprise market and to focus more on recurring revenue from end users rather than single-time licensing fees from their OEM partners. MySQL launched the MySQL Network modeled after the RedHat Network in 2005. The MySQL Network is a subscription service targeted at end-users that provide updates, notifications, alerts and product-level support designed to make it easier for companies to manage hundreds of MySQL servers. MySQL 5 ships and holds numerous new features to go after enterprise users (e.g. stored procedures, cursors, triggers, distributed transactions, views, federated storage engines, etc.).  It ended the year 2005 with $34 million in revenue based on 3400 customers.

2006-2010 year: In 2006 Mårten Mickos confirms that Oracle tried to buy MySQL. Oracle buys Sleepycat, MySQL was provided by this company with the Berkeley DB transactional storage engine. Mårten Mickos declares that company is making MySQL ready for an IPO in 2008 on a projected $100 million in revenues. 320 employees in 25 countries are employed by MySQL, 70 percent of them work from home. MySQL is estimated to have a 33% market share measured in install base and approximately 0.2% market share measured in revenue (the database market was a $15 billion market in 2006). In the year 2008, Sun Microsystems acquired MySQL AB for approximately $1 billion. Two of MySQL AB's co-founders, Michael Widenius (Monty) and David Axmark, leave Sun shortly later the acquisition. Sun Microsystems and Oracle declared that they have entered into an ultimate agreement under which Oracle will procure Sun common stock for $9.50 per share in cash. The transaction costs $7.4 billion approximately.

February 2016 update: After 6 years, several small adjustments have been made based on feedback.  It's also worth noting that MySQL is still going strong 8 years after the acquisition by Sun. Google, Facebook, Wikipedia, Yahoo and virtually every WordPress and Drupal site still uses MySQL. Engineering is headed by Tomas Ulin, he joined MySQL AB back in 2003. The whole business is run by Richard Mason who joined MySQL AB in 2005. The team size increased, but at the core people are same as before. The team is distributed, as always. The optimizer has been essentially rewritten by a team in Norway that was added to the MySQL team when the company was picked up by Sun. NoSQL features have been added.

System Requirement

Refer below table for system requirement according to platform:

MySQL table example

 

 

 

 

 

How to Install MySQL on Linux/UNIX

The suggested way to install MySQL on a Linux system is via RPM. MySQL AB makes the following RPMs accessible for download on its web site:

  • MySQL - The MySQL database server, which manages databases and tables, processes SQL queries and controls user access.
  • MySQL-client - MySQL client programs, which make it possible to connect and interact with the server.
  • MySQL-devel – These are the libraries and header files that come in handy for compiling other programs that use MySQL.
  • MySQL-shared - Shared libraries for the MySQL client.
  • MySQL-bench - Benchmark and performance testing tools for the MySQL database server.

Follow the following steps to proceed for installation:

  • Login to the system using root user and switch to the directory containing the RPMs. By executing the following command we can install the MySQL database server:
  • [root@host]# rpm -i MySQL-5.0.9-0.i386.rpm
  • Above command takes care of the process of installing MySQL server, creating a user of MySQL, then it creates necessary configuration and start MySQL server automatically.

Create Database using MySQL

We would need special privileges to create or to delete a MySQL database. So assuming we have access to root user, then we can create any database using MySQL admin binary.

Example:

Here is a simple example to create database called Neelam:

[root@host]# mysqladmin -u root -p create Neelam

Enter password:******

Drop Database using MySQLadmin

Be careful while deleting any database because we will lose our all the data available in our database.

Here is an example to delete a database created in previous example:

[root@host]# mysqladmin -u root -p drop Neelam

Enter password:******

  • This will give us a warning and it will confirm if we really want to delete this database or not.
  • Dropping the database is hypothetically a very bad thing to do.
  • Any data stored in the database will be destroyed.
  • Do we really want to drop the 'Neelam' database [y/N] y
  • Database “Neelam” dropped
NOTE: All the database names, table names, table fields name are case sensitive. So we would have to use proper names while giving any SQL command.

Create MySQL Tables

This is the command for table creation. It requires:

  • Name of the table
  • Names of fields
  • Definitions for each field
  • Definitions for each field

Syntax:

Following is generic SQL syntax for creating a MySQL table:

CREATE TABLE table_name (column_name column_type);

Now, we will create following table in NEELAM database.

neelam_tbl(

neelam _id INT NOT NULL AUTO_INCREMENT,

neelam _title VARCHAR(100) NOT NULL,

neelam _author VARCHAR(40) NOT NULL,

submission_date DATE,

PRIMARY KEY (neelam _id ) );

Few items need explanation here:

We do not want this field to be NULL thus Field Attribute NOT NULL is being used. So if user will attempt to create a record with NULL value, then MySQL will raise an error.

Field Attribute AUTO_INCREMENT tells MySQL to add the next available number to the id field.

Keyword PRIMARY KEY is used to define a column as primary key. We can use multiple columns separated by comma to define a primary key.

Drop MySQL Tables

It is very easy to drop an existing MySQL table, but we should be careful while deleting any existing table because the data lost in this process will not be recovered after deleting a table.

Syntax:

Following is generic SQL syntax for dropping a MySQL table:

DROP TABLE table_name ;

Dropping Tables from Command Prompt:

To do this we needs just to execute DROP TABLE SQL command at mysql> prompt.

Example:

Following is an example, which deletes tutorials_tbl:

root@host# mysql -u root -p

Enter password:*******

mysql> use NEELAM;

Database changed

mysql> DROP TABLE neelam_tbl

Query OK, 0 rows affected (0.8 sec)

mysql>

 

Learn MySQL programming by studying our MySQL Tutorial!

 

About The Author: Hi! I am Neelam Y. I am passionate about research and technology. Whether it is website designing/development, content writing or internet marketing; I have a solid track record of delivering utmost satisfaction to my clients. If you want me to provide you the finest of my services, you can contact me on upwork.com by following link: https://www.upwork.com/users/~01ea293264ce65c7ea