preface

MySQL database is the most popular database for Web development. This chapter introduces concepts related to database, and explains how to install and configure MySQL.


Overview of MySQL

MySQL is a relational database management system developed by MySQL AB, a Swedish company. It is currently a product of Oracle. MySQL is one of the most popular relational database management systems. In WEB applications, MySQL is the best RDBMS application software. The SQL language used by MySQL is the most commonly used standardized language for accessing databases. MySQL software adopts the double licensing policy, which is divided into community edition and commercial edition. Due to its small size, fast speed and low total cost of ownership, especially the characteristics of open source, MySQL is generally selected as the website database for the development of small and medium-sized websites.

Development history of MySQL

1. The history of MySQL can be traced back to 1979, when a programmer named Monty Widenius worked for a small company called TcX and designed a reporting tool in BASIC that could run on a computer with a 4MHz frequency and 16KB memory. At the time, it was just a very low-level, reports-only storage engine called Unireg. In 1990, TcX began receiving requests from customers for SQL support for its apis. Monty borrows directly from mSQL code and integrates it into its own storage engine. Disappointingly, the results were less than satisfactory, and determined to rewrite a SQL support yourself. 3. In 1996, MySQL 1.0 was released. It was available to a small group of people, and it was an internal release. By October 1996, MySQL 3.11.1 was released (MySQL didn’t have 2.x), and at first only binary versions were available under Solaris. A month later, a Linux version appeared. Over the next two years, MySQL was ported to each platform in turn. 4. MySQL AB was founded in Sweden in 1999 ~ 2000. Monty hired a couple of people to work with Sleepycat to create the Berkeley DB engine, and since BDB supports transactions, MySQL has since started supporting transactions. 5. In 2000, MySQL not only released its own source code, but also adopted the GPL(GNU General Public License) License, officially entering the open source world. In April of the same year, MySQL cleaned up the old storage engine ISAM and named it MyISAM. 2001 – Integrated Heikki Tuuri’s InnoDB storage engine, which not only holds transactions, but also supports row-level locking. This engine later proved to be the most successful MySQL transaction storage engine. In December 2003, MySQL 5.0 was released, providing views, stored procedures and other functions. 8. In January 2008, MySQL AB was acquired by Sun For usd 1 billion, and MySQL database entered the era of Sun. In Sun era, Sun company carried out a lot of promotion, optimization, Bug repair and so on. In November 2008, MySQL 5.1 was released, providing partitioning, event management, row-based replication, and disk-based NDB clustering systems, while fixing a number of bugs. In April 2009, Oracle acquired Sun for $7.4 billion, which brought MySQL database into Oracle’s era. InnoDB, its third-party storage engine, was acquired by Oracle in 2005.

System features

1. Written in C and C++, and tested with a variety of compilers to ensure the portability of source code. 2, support AIX, FreeBSD, HP-UX, Linux, Mac OS, NovellNetware, OpenBSD, OS/2 Wrap, Solaris, Windows and other operating systems. 3. Provides apis for multiple programming languages. Including C, C++, Python, Java, Perl, PHP, Eiffel, Ruby,.NET and Tcl. 4, support multi-threading, make full use of CPU resources. 5, the optimized SQL query algorithm, effectively improve the query speed. 6, can be used as a separate application in the client server network environment, can also be embedded in other software as a library. 7, provide multi-language support, common codes such as Chinese GB 2312, BIG5, Japanese Shift_JIS and so on can be used as data table names and data column names. 8, provide TCP/IP, ODBC and JDBC and other database connections. 9. Provides management tools for managing, checking, and optimizing database operations. 10. Support large databases. Can handle large databases with tens of millions of records. 11. Support a variety of storage engines. MySQL is open source, so you don’t need to pay extra. MySQL uses the standard SQL data language. \

The installation of MySQL

Download the latest MySQL from the official website:

Dev.mysql.com/downloads/w…



Installer belongs to the installation version, there are detailed installation guidance, the upper 20M is the online installation version, the lower 300M is the local installation version, here we download the local installation package.

Open the installation package, check Accept the license terms, and click Next



Next, select the default first developer option and continue clicking Next





If you don’t need any of these functions, you can just click Next and click Execute







To start the configuration, click Next



Click Next

Set the account and password here



And then?



And then?



And then?



And then what? It’s over



After the installation is complete, view system services and enter services.msc



Check the MySQL service. If the MySQL service is running, the installation is complete.

Configuration of environment variables

Click on my computer -> right click on Properties -> Advanced System Settings -> Environment Variables

Click New in system variables to add:

Variable name: MYSQL_HOME

Variable value: installation directory of MySQL



Edit the Path system variable and add %MYSQL_HOME%\bin

Command line tool

MySQL comes with a command line tool that we can use to test the basic functionality of MySQL.

Go to Start — > Run — > enter CMD

On the CLI, you can use the mysql command to log in to the mysql database

Enter: mysql -u root -p Press Enter and enter the password. After the authentication succeeds, you can log in to the system.



If you want to enter MySQL, you can enter a simple MySQL command to test it:

Show databases; Enter the database. Use The database name. Show tables; Table name desc; Select * from table_name; Exit the system.Copy the code

conclusion

In this chapter, we will learn how to manage the MySQL database. If you can help us, we will learn how to manage the MySQL database