MySQL 8 Cookbook
Karthik Appigatla, Kedar Mohaniraj Vaijanapukar
- 446 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
MySQL 8 Cookbook
Karthik Appigatla, Kedar Mohaniraj Vaijanapukar
About This Book
Design and administer enterprise-grade MySQL 8 solutionsAbout This Book• Store, retrieve, and manipulate your data using the latest MySQL 8 features• Practical recipes on effective administration in MySQL, with a focus on security, performance tuning, troubleshooting, and more• Contains tips, tricks, and best practices for designing, developing, and administering your MySQL 8 database solution without any hassleWho This Book Is ForIf you are a MySQL developer or administrator looking for quick, handy solutions to solve the most common and not-so-common problems in MySQL, this book is for you. MySQL DBAs looking to get up-to-speed with the latest MySQL 8 development and administration features will also find this book very useful. Prior knowledge of Linux and RDBMS is desirable.What You Will Learn• Install and configure your MySQL 8 instance without any hassle• Get to grips with new features of MySQL 8 like CTE, Window functions and many more• Perform backup tasks, recover data and set up various replication topologies for your database• Maximize performance by using new features of MySQL 8 like descending indexes, controlling query optimizer and resource groups• Learn how to use general table space to suit the SaaS or multi-tenant applications• Analyze slow queries using performance schema, sys schema and third party tools• Manage and monitor your MySQL instance and implement efficient performance-tuning tasksIn DetailMySQL is one of the most popular and widely used relational databases in the World today. The recently released MySQL 8 version promises to be better and more efficient than ever before.This book contains everything you need to know to be the go-to person in your organization when it comes to MySQL. Starting with a quick installation and configuration of your MySQL instance, the book quickly jumps into the querying aspects of MySQL. It shows you the newest improvements in MySQL 8 and gives you hands-on experience in managing high-transaction and real-time datasets. If you've already worked with MySQL before and are looking to migrate your application to MySQL 8, this book will also show you how to do that. The book also contains recipes on efficient MySQL administration, with tips on effective user management, data recovery, security, database monitoring, performance tuning, troubleshooting, and more.With quick solutions to common and not-so-common problems you might encounter while working with MySQL 8, the book contains practical tips and tricks to give you the edge over others in designing, developing, and administering your database effectively.Style and approachThis book takes a recipe-based approach to tackling the pain points of SQL developers. It is a comprehensive book full of solutions to common problems faced by SQL administrators and developers alike.
Frequently asked questions
Information
Using MySQL
- Connecting to MySQL using the command-line client
- Creating databases
- Creating tables
- Inserting, updating, and deleting rows
- Loading sample data
- Selecting data
- Sorting results
- Grouping results (aggregate functions)
- Creating users
- Granting and revoking access to users
- Selecting data into a file and table
- Loading data into a table
- Joining tables
- Stored procedures
- Functions
- Triggers
- Views
- Events
- Getting information about databases and tables
Introduction
Connecting to MySQL using the command-line client
Getting ready
How to do it...
shell> mysql -h localhost -P 3306 -u <username> -p<password>
shell> mysql --host=localhost --port=3306 --user=root --password=<password>
shell> mysql --host localhost --port 3306 --user root --password=<password>
shell> mysql --host=localhost --port=3306 --user=root --password
Enter Password:
- The -P argument (in uppercase) is passed for specifying the port.
- The -p argument (in lowercase) is passed for specifying the password.
- There is no space after the -p argument.
- For the password, there is no space after =.
- To know the current user:
shell> whoami
- To disconnect, press Ctrl + D or type exit:
mysql> ^DBye
shell>
mysql> exit;
Bye
shell>
- After connecting to the mysql prompt, you can execute statements followed by the delimiter. The default delimiter is a semicolon (;):
mysql> SELECT 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)
- To cancel a command, press Ctrl + C or type \c:
mysql> SELECT ^C
mysql> SELECT \c
See also
Warning: Using a password on the command line interface can be insecure.
; or \g—output is displayed horizontally, \G—output is displayed vertically.
Creating databases
customer id=1, first_name=Mike, last_name=Christensen country=USA
customer id=2, first_name=Andy, last_name=Hollands, country=Australia
customer id=3, first_name=Ravi, last_name=Vedantam, country=India
customer id=4, first_name= Rajiv, last_name=Perera, country=Sri Lanka