From 0518984a627348f83079d73aae6443d845f10e3e Mon Sep 17 00:00:00 2001 From: Patrick Birch <48594400+patrickbirch@users.noreply.github.com> Date: Tue, 8 Oct 2024 08:19:40 -0500 Subject: [PATCH] PS-9383 Test and update Quickstart for 8.4 new file: docs/quickstart-apt.md new file: docs/quickstart-docker.md modified: docs/quickstart-overview.md modified: mkdocs-base.yml --- docs/quickstart-apt.md | 578 ++++++++++++++++++++++++++++++++++++ docs/quickstart-docker.md | 410 +++++++++++++++++++++++++ docs/quickstart-overview.md | 46 ++- docs/quickstart-yum.md | 550 ++++++++++++++++++++++++++++++++++ mkdocs-base.yml | 8 +- variables.yml | 4 + 6 files changed, 1566 insertions(+), 30 deletions(-) create mode 100644 docs/quickstart-apt.md create mode 100644 docs/quickstart-docker.md create mode 100644 docs/quickstart-yum.md diff --git a/docs/quickstart-apt.md b/docs/quickstart-apt.md new file mode 100644 index 00000000000..10898341c59 --- /dev/null +++ b/docs/quickstart-apt.md @@ -0,0 +1,578 @@ +# Install Percona Server for MySQL and create a database on Ubuntu + +Use the Percona repositories to install using APT. + +## Prerequisits + +* Either use `sudo` or run as root + +* Stable Internet access + +## Installation steps + +The examles of the "expected output" depend on the operating system. The following examples are based on an installation in Ubuntu 22.04 (Jammy Jellyfish). +{.power-number} + +1. Update the package index. + + ```{.bash data-prompt="$"} + $ sudo apt update + ``` + + The result depends on the operating system. + + ??? example "Expected output" + + ```{.text .no-copy} + Hit:1 http://us.archive.ubuntu.com/ubuntu jammy InRelease + Get:2 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB] + Hit:3 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease + ... + ``` + +2. Install curl.apt + + ```{.bash data-prompt="$"} + $ sudo apt install -y curl + ``` + + The result depends on the operating system. + + ??? example "Expected output" + + ```{.text .no-copy} + Reading package lists... Done + Building dependency tree... Done + Reading state information... Done + ... + ``` + +3. Download the `percona-release` repository package: + + ```{.bash data-prompt="$"} + $ curl -O https://repo.percona.com/apt/percona-release_latest.generic_all.deb + ``` + + You should see the following result: + + ??? example "Expected output" + + ```{.text .no-copy} + % Total % Received % Xferd Average Speed Time Time Time Current + Dload Upload Total Spent Left Speed + 100 11804 100 11804 0 0 17375 0 --:--:-- --:--:-- --:--:-- 17358 + + ... + ``` + +4. Install the downloaded package and any dependencies: + + ```{.bash data-prompt="$"} + $ sudo apt install -y gnupg2 lsb-release ./percona-release_latest.generic_all.deb + ``` + + You should see the following result: + + ??? example "Expected output" + + ```{.text .no-copy} + Reading package lists... Done + Building dependency tree... Done + Reading state information... Done + Note, selecting 'percona-release' instead of './percona-release_latest.generic_all.deb' + lsb-release is already the newest version (11.1.0ubuntu4). + lsb-release set to manually installed. + ... + ``` + +5. Update the package listing. + + ```{.bash data-prompt="$"} + $ sudo apt update + ``` + + The result depends on the operating system. + + ??? example "Expected output" + + ```{.text .no-copy} + Hit:1 http://us.archive.ubuntu.com/ubuntu jammy InRelease + Get:2 http://repo.percona.com/percona/apt jammy InRelease [15.7 kB] + Hit:3 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease + Hit:4 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease + ... + ``` + +6. Set up the Percona Server for MySQL 8.0 repository: + + ```{.bash data-prompt="$"} + $ sudo percona-release setup ps80 + ``` + + The result depends on the operating system. + + ??? example "Expected output" + + ```{.text .no-copy} + * Disabling all Percona Repositories + * Enabling the Percona Server 8.0 repository + * Enabling the Percona Tools repository + Hit:1 http://us.archive.ubuntu.com/ubuntu jammy InRelease + Hit:2 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease + Hit:3 http://repo.percona.com/prel/apt jammy InRelease + ... + ``` + +7. Enable the Percona Server for MySQL release. + + ```{.bash data-prompt="$"} + $ sudo percona-release enable ps-80 release + ``` + + You should see the following result: + + ??? example "Expected output" + + ```{.text .no-copy} + * Enabling the Percona Server 8.0 repository + <*> All done! + ==> Please run "apt-get update" to apply changes + ``` + +8. Update the package listing. + + ```{.bash data-prompt="$"} + $ sudo apt update + ``` + + The result depends on the operating system. The following result is based on Ubuntu 22.04: + + ??? example "Expected output" + + ```{.text .no-copy} + Hit:1 http://us.archive.ubuntu.com/ubuntu jammy InRelease + Get:2 http://repo.percona.com/percona/apt jammy InRelease [15.7 kB] + Hit:3 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease + Hit:4 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease + ... + ``` + +9. Install Percona Server for MySQL 8.0. + + ```{.bash data-prompt="$"} + $ sudo apt install -y percona-server-server + ``` + + The result depends on the operating system. The following result is based on Ubuntu 22.04: + + ??? example "Expected output" + + ```{.text .no-copy} + Reading package lists... Done + Building dependency tree... Done + Reading state information... Done + The following additional packages will be installed: + debsums libaio1 libdpkg-perl libfile-fcntllock-perl libfile-fnmatch-perl libmecab2 + percona-server-client percona-server-common + Suggested packages: + debian-keyring gcc | c-compiler binutils git bzr + The following NEW packages will be installed: + debsums libaio1 libdpkg-perl libfile-fcntllock-perl libfile-fnmatch-perl libmecab2 + percona-server-client percona-server-common percona-server-server + 0 upgraded, 9 newly installed, 0 to remove and 161 not upgraded. + Need to get 172 MB of archives. + After this operation, 612 MB of additional disk space will be used. + ... + ``` + +10. The installation asks you to enter a password. We use 'secret' for these examples, but you can use any password, but you must remember to use your password for the rest of the Quickstart. + + ![Add a password](_static/strong-password.png "Add a password") + +11. Confirm your password. + + ![Confirm the password](_static/confirm-password.png "Confirm the password") + +12. Choose the type of authentication, based on the compatibility and the security requirements of your applications. + + The Strong password encryption uses a more secure hashing algorithm to store and verify passwords, which makes it harder for attackers to crack them. + + The Legacy authentication method uses the older and less secure hashing algorithm that was used in previous versions of MySQL. + + ![Type of authentication](_static/mysql-authentication.png "Select a type of authentication") + +13. [Optional] You can increase the security of MySQL by running`sudo mysql_secure installation`. + + After installing MySQL, you should run the `mysql_secure_installation` script to improve the security of your database server. This script helps you perform several important tasks, such as: + + - Set a password for the root user + + - Select a level for the password validation policy + + - Remove anonymous users + + - Disable root login remotely + + - Remove the test database + + - Reload the privilege table to ensure all changes take effect immediately + + By running this script, you can prevent unauthorized access to your server and protect your data from potential threats. + + ```{.bash data-prompt="$"} + $ sudo mysql_secure_installation + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + Securing the MySQL server deployment. + + Enter password for user root: + + VALIDATE PASSWORD COMPONENT can be used to test passwords + and improve security. It checks the strength of password + and allows the users to set only those passwords which are + secure enough. Would you like to setup VALIDATE PASSWORD component? + + Press y|Y for Yes, any other key for No: + + There are three levels of password validation policy: + + LOW Length >= 8 + MEDIUM Length >= 8, numeric, mixed case, and special characters + STRONG Length >= 8, numeric, mixed case, special characters and dictionary file + + Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1 + Using existing password for root. + + Estimated strength of the password: 0 + Change the password for root ? ((Press y|Y for Yes, any other key for No) : + + New password: + + Re-enter new password: + + Estimated strength of the password: 100 + Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : + By default, a MySQL installation has an anonymous user, + allowing anyone to log into MySQL without having to have + a user account created for them. This is intended only for + testing, and to make the installation go a bit smoother. + You should remove them before moving into a production + environment. + + Remove anonymous users? (Press y|Y for Yes, any other key for No) : + Success. + + Normally, root should only be allowed to connect from + 'localhost'. This ensures that someone cannot guess at + the root password from the network. + + Disallow root login remotely? (Press y|Y for Yes, any other key for No) : + Success. + + By default, MySQL comes with a database named 'test' that + anyone can access. This is also intended only for testing, + and should be removed before moving into a production + environment. + + Remove test database and access to it? (Press y|Y for Yes, any other key for No) : + - Dropping test database... + Success. + + - Removing privileges on test database... + Success. + + Reloading the privilege tables will ensure that all changes + made so far will take effect immediately. + + Reload privilege tables now? (Press y|Y for Yes, any other key for No) : + Success. + + All done! + ``` + +14. When the installation completes, check the service status. + + ```{.bash data-prompt="$"} + $ sudo systemctl status mysql + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + ● mysql.service - Percona Server + Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) + Active: active (running) since Fri 2024-02-16 10:24:58 UTC; 3min 7s ago + Process: 4456 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS) + Main PID: 4501 (mysqld) + Status: "Server is operational" + Tasks: 39 (limit: 2219) + Memory: 371.7M + CPU: 11.800s + CGroup: /system.slice/mysql.service + └─4501 /usr/sbin/mysqld + + Feb 16 10:24:56 vagrant systemd[1]: Starting Percona Server... + Feb 16 10:24:58 vagrant systemd[1]: Started Percona Server. + ``` + + If needed, restart the service + + ```{.bash data-prompt="$"} + $ sudo systemctl status mysql + ``` + +15. Log in to the server. Use the password that you entered during the installation process, which could be `secret`orwhatever password you have selected. You do not see the characters in the password as you type. + + ```{.bash data-prompt="$"} + $ mysql -uroot -p + Enter password: + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + Welcome to the MySQL monitor. Commands end with ; or \g. + Your MySQL connection id is 10 + Server version: {{tag}} Percona Server (GPL), Release 1, Revision 238b3c02 + + Copyright (c) 2009-{{year_tag}} Percona LLC and/or its affiliates + Copyright (c) 2000, {{year_tag}}, Oracle and/or its affiliates. + + Oracle is a registered trademark of Oracle Corporation and/or its + affiliates. Other names may be trademarks of their respective + owners. + + Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + + mysql> + ``` + + +## Create a database + +??? Example "Benefits and what to watch out for when creating databases and tables" + + Creating a database and table has the following benefits: + + - Store and organize your data in a structured and consistent way. + - Query and manipulate your data using SQL. + - Enforce data integrity and security using constraints, triggers, views, roles, and permissions. + - Optimize your data access and performance using indexes, partitions, caching, and other techniques. + + When you create a table, design your database schema carefully, changing it later may be difficult and costly. You should experiment with concurrency, transactions, locking, isolation, and other issues that may arise when multiple users access the same data. You must backup and restore your data regularly, as data loss or corruption may occur due to hardware failures, human errors, or malicious attacks. + +To create a database, use the `CREATE DATABASE` statement. You can optionally specify the character set and collation for the database in the statement. After the database is created, select the database using the `USE` statement or the `-D` option in the MySQL client. + +```{.bash data-prompt="mysql>"} +mysql> CREATE DATABASE mydb; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 1 row affected (0.01 sec) + ``` + +```{.bash data-prompt="mysql>"} +mysql> use mydb; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Database changed + ``` + +## Create a table + +Create a table using the `CREATE TABLE` statement. You can specify the values for each column or use the DEFAULT keyword for columns with default values, data types, constraints, indexes, and other options. + +```{.bash data-prompt="mysql>"} +mysql> CREATE TABLE `employees` ( + `id` mediumint(8) unsigned NOT NULL auto_increment, + `name` varchar(255) default NULL, + `email` varchar(255) default NULL, + `country` varchar(100) default NULL, + PRIMARY KEY (`id`) +) AUTO_INCREMENT=1; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 0 rows affected, 1 warning (0.03 sec) + ``` + +## Insert data into the table + +Insert data into the table using the `INSERT INTO` SQL statement. This statement adds multiple records into a table in one statement. + + +```{.bash data-prompt="mysql>"} +mysql> INSERT INTO `employees` (`name`,`email`,`country`) +VALUES + ("Erasmus Richardson","posuere.cubilia.curae@outlook.net","England"), + ("Jenna French","rhoncus.donec@hotmail.couk","Canada"), + ("Alfred Dejesus","interdum@aol.org","Austria"), + ("Hamilton Puckett","dapibus.quam@outlook.com","Canada"), + ("Michal Brzezinski","magna@icloud.pl","Poland"), + ("Zofia Lis","zofial00@hotmail.pl","Poland"), + ("Aisha Yakubu","ayakubu80@outlook.com","Nigeria"), + ("Miguel Cardenas","euismod@yahoo.com","Peru"), + ("Luke Jansen","nibh@hotmail.edu","Netherlands"), + ("Roger Pettersen","nunc@protonmail.no","Norway"); +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 10 rows affected (0.02 sec) + Records: 10 Duplicates: 0 Warnings: 0 + ``` + +## Run a SELECT query + +SELECT queries retrieve data from one or more tables based on specified criteria. They are the most common type of query and can be used for various purposes, such as displaying, filtering, sorting, aggregating, or joining data. SELECT queries do not modify the data in the database but can affect the performance if the query involves large or complex datasets. + + + +```{.bash data-prompt="mysql>"} +mysql>SELECT id, name, email, country FROM employees WHERE country = 'Poland'; +``` + +??? example "Expected output" + + ```{.text .no-copy} + +----+-------------------+---------------------+---------+ + | id | name | email | country | + +----+-------------------+---------------------+---------+ + | 5 | Michal Brzezinski | magna@icloud.pl | Poland | + | 6 | Zofia Lis | zofial00@hotmail.pl | Poland | + +----+-------------------+---------------------+---------+ + 2 rows in set (0.00 sec) + ``` + +## Run an Update query + +UPDATE queries modify existing data in a table. They are used to change or correct the information stored in the database. UPDATE queries can update one or more columns and rows simultaneously, depending on the specified conditions. They may also fail if they violate any constraints or rules defined on the table. + + An example of an UPDATE query and then run a [SELECT](#select-query) with a WHERE clause to verify the update. + +```{.bash data-prompt="mysql>"} +mysql> UPDATE employees SET name = 'Zofia Niemec' WHERE id = 6; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 1 row affected (0.01 sec) + Rows matched: 1 Changed: 1 Warnings: 0 + ``` + +```{.bash data-prompt="mysql>"} +mysql> SELECT name FROM employees WHERE id = 6; +``` + +??? example "Expected output" + + ```{.text .no-copy} + +--------------+ + | name | + +--------------+ + | Zofia Niemec | + +--------------+ + 1 row in set (0.00 sec) + ``` + +## Run an INSERT query + +INSERT queries add new data to a table. They are used to populate the database with new information. INSERT queries can insert one or more rows at a time, depending on the syntax. The query may fail if it violates any constraints or rules defined on the table, such as primary keys, foreign keys, unique indexes, or triggers. + +Insert a row into a table and then run a [SELECT](#select-query) with a WHERE clause to verify the record was inserted. + +```{.bash data-prompt="mysql>"} +mysql> INSERT INTO `employees` (`name`,`email`,`country`) +VALUES +("Kenzo Sasaki","KenSasaki@outlook.com","Japan"); +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 1 row affected (0.01 sec) + ``` + +```{.bash data-prompt="mysql>"} +mysql> SELECT id, name, email, country FROM employees WHERE id = 11; +``` + +??? example "Expected output" + + ```{.text .no-copy} + +----+--------------+-----------------------+---------+ + | id | name | email | country | + +----+--------------+-----------------------+---------+ + | 11 | Kenzo Sasaki | KenSasaki@outlook.com | Japan | + +----+--------------+-----------------------+---------+ + 1 row in set (0.00 sec) + ``` + +## Run a Delete query + +DELETE queries remove existing data from a table. They are used to clean up the information no longer needed or relevant in the database. The DELETE queries can delete one or more rows at a time, depending on the specified conditions. They may also trigger cascading deletes on related tables if foreign key constraints are enforced. + +Delete a row in the table and run a [SELECT](#select-query) with a WHERE clause to verify the deletion. + +```{.bash data-prompt="mysql>"} +mysql> DELETE FROM employees WHERE id >= 11; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 1 row affected (0.01 sec) + ``` + +```{.bash data-prompt="mysql>"} +mysql> SELECT id, name, email, country FROM employees WHERE id > 10; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Empty set (0.00 sec) + ``` + + +## Troubleshooting + +* Connection Issues: Double-check credentials, ensure service is running, and verify firewall configurations if applicable. + +* Permission Errors: Grant necessary permissions to users using GRANT statements within the MySQL shell. + +* Package Installation Issues: Refer to Percona documentation and online forums for specific error messages and solutions. + +##Security best practices + +* Strong Passwords: Utilize complex and unique passwords for all users, especially the root account. + +* Minimize Permissions: Grant users only the privileges necessary for their tasks. + +* Disable Unnecessary Accounts: Remove test accounts and unused accounts. + +* Regular Backups: Implement consistent backup routines to safeguard your data. + +* Keep Software Updated: Maintain Percona Server and related packages updated with security patches. + +* Monitor Server Activity: Employ tools, like [Percona Monitoring and Management], and logs to monitor server activity for suspicious behavior. + +## Next step + +[Choose your next steps:material-arrow-right:](quickstart-next-steps.md){.md-button} + + + +[Percona Monitoring and Management]: https://docs.percona.com/percona-monitoring-and-management \ No newline at end of file diff --git a/docs/quickstart-docker.md b/docs/quickstart-docker.md new file mode 100644 index 00000000000..02692da1c4f --- /dev/null +++ b/docs/quickstart-docker.md @@ -0,0 +1,410 @@ +# Quickstart - Run Percona Server for MySQL container images with Docker + +You are welcome to name any items to match your organization's standards or use your table structure and data. If you do, the results are different from the expected results. + +## Prerequisites + +* Docker Engine installed and running +* Stable internet connection +* Basic understanding of the command-line interface (CLI) + +Always adapt the commands and configurations to your specific environment and security requirements. + + +## Start a Docker container + +To use the "Docker run" command, specify the name or ID of the image you want to use and, optionally, some flags and arguments that modify the container's behavior. The command has the following options: + +| Option | Description | +|---|---| +| `-d` | Runs the container in detached mode, allowing the container to operate in the background. | +| `-p 3306:3306` |Maps the container's MySQLport (3306) tothe same port yourhost, enabling external access.| +| `--name psmysql` | Provides a meaningful name to the container. If you do not use this option, Docker adds a random name. | +| `-e MYSQL_ROOT_PASSWORD=secret` | Adds an environmental variable and changes the password from the default password. | +| `--v myvol:/var/lib/mysql` | Mounts a host directory (myvol) as the container's data volume, ensuring persistent storage for the database between container lifecycles. | +| `percona/percona-server:8.0.34` | The image with the tag (8.0.34) to specify a specific release. | + +You must provide at least one environment variable to access the database, such as `MYSQL_ROOT_PASSWORD`, `MYSQL_DATABASE`, `MYSQL_USER`, and `MYSQL_PASSWORD` or the instance refuses to initialize. + +If needed, you can replace the `secret` password with a [stronger password](#security-measures). + +For this document, we add the `8.0.34` tag. In Docker, a tag is a label assigned to an image and is used to maintain different versions of an image. If we did not add a tag, Docker uses `latest` as the default tag and downloads the latest image from [percona/percona-server on the Docker Hub]. + +To run the Docker ARM64 version of Percona Server for MySQL, use the `8.4.0-aarch64` tag instead of `8.4.0`. + +```{.bash data-prompt="$"} +$ docker run -d -p 3306:3306 --name psmysql \ +--platform linux/amd64 \ +-e MYSQL_ROOT_PASSWORD=secret \ +-v myvol:/var/lib/mysql \ +percona/percona-server:8.4.0 +``` + +??? example "Expected output" + + ```{.text .no-copy} + Unable to find image 'percona/percona-server:8.4' locally + 8.4: Pulling from percona/percona-server + b902d6b6048a: Pull complete + 16cef723486e: Pull complete + 66df07bf7a1c: Pull complete + b2963ee1caa4: Pull complete + 8ff166e7ebab: Pull complete + fc0329eb813b: Pull complete + 46522d05868c: Pull complete + 8a91dcc6141f: Pull complete + 2225668f8cee: Pull complete + Digest: sha256:ec4cdd25ec3887a90282dda1298a475a88429953fd7e2718e22fd6e205626047 + Status: Downloaded newer image for percona/percona-server:8.4 + 708ba1f9874cbc09441d18b1ca5d9c0a6f045b27e54aafe15fdd78eda8ef3ecf + ``` + +## Connect to the database instance + +To connect to a MySQL database on a container, use the Docker exec command with the database instance connect command. You must know the name or ID of the container that runs the database server and the database credentials. + +The Docker exec command runs a specified command in a running container. The database instance connect command connects to a MySQL server with the user name and password. + +For this example, we have the following options: + +| Option | Description | +| ----------- | ---------------------------------------------------------------------------------- | +| `it` | Interact with the container and be a pseudo-terminal | +| `psmysql` | Running container name | +| `mysql` | Connects to a database instance | +| `-u` | Specifies the user account used to connect | +| `-p` | Use this password when connecting | + +You must enter the password when the server prompts you. + +Connect to the database instance example + +```{.bash data-prompt="$"} +$ docker exec -it psmysql mysql -uroot -p +``` + +You are prompted to enter the password, which is `secret`. If you have changed the password, use your password. You will not see any characters as you type. + +```{.text .no-copy} +Enter password: +``` + +You should see the following result. + +??? example "Expected output" + + ```{.text .no-copy} + Welcome to the MySQL monitor. Commands end with ; or \g. + Your MySQL connection id is 10 + Server version: 8.4.0-1 Percona Server (GPL), Release 1, Revision 238b3c02 + + Copyright (c) 2009-2024 Percona LLC and/or its affiliates + Copyright (c) 2000, 2024, Oracle and/or its affiliates. + + Oracle is a registered trademark of Oracle Corporation and/or its + affiliates. Other names may be trademarks of their respective + owners. + + Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + + mysql> + ``` + +## Create a database + +??? Example "Benefits and what to watch out for when creating databases and tables" + + Creating a database and table has the following benefits: + + - Store and organize your data in a structured and consistent way. + - Query and manipulate your data using SQL. + - Enforce data integrity and security using constraints, triggers, views, roles, and permissions. + - Optimize your data access and performance using indexes, partitions, caching, and other techniques. + + When you create a table, design your database schema carefully, changing it later may be difficult and costly. You should experiment with concurrency, transactions, locking, isolation, and other issues that may arise when multiple users access the same data. You must backup and restore your data regularly, as data loss or corruption may occur due to hardware failures, human errors, or malicious attacks. + +To create a database, use the `CREATE DATABASE` statement. You can optionally specify the character set and collation for the database in the statement. After the database is created, select the database using the `USE` statement or the `-D` option in the MySQL client. + +```{.bash data-prompt="mysql>"} +mysql> CREATE DATABASE mydb; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 1 row affected (0.01 sec) + ``` + +```{.bash data-prompt="mysql>"} +mysql> use mydb; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Database changed + ``` + +## Create a table + +Create a table using the `CREATE TABLE` statement. You can specify the values for each column or use the DEFAULT keyword for columns with default values, data types, constraints, indexes, and other options. + +```{.bash data-prompt="mysql>"} +mysql> CREATE TABLE `employees` ( + `id` mediumint(8) unsigned NOT NULL auto_increment, + `name` varchar(255) default NULL, + `email` varchar(255) default NULL, + `country` varchar(100) default NULL, + PRIMARY KEY (`id`) +) AUTO_INCREMENT=1; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 0 rows affected, 1 warning (0.03 sec) + ``` + +## Insert data into the table + +Insert data into the table using the `INSERT INTO` SQL statement. This statement adds multiple records into a table in one statement. + + +```{.bash data-prompt="mysql>"} +mysql> INSERT INTO `employees` (`name`,`email`,`country`) +VALUES + ("Erasmus Richardson","posuere.cubilia.curae@outlook.net","England"), + ("Jenna French","rhoncus.donec@hotmail.couk","Canada"), + ("Alfred Dejesus","interdum@aol.org","Austria"), + ("Hamilton Puckett","dapibus.quam@outlook.com","Canada"), + ("Michal Brzezinski","magna@icloud.pl","Poland"), + ("Zofia Lis","zofial00@hotmail.pl","Poland"), + ("Aisha Yakubu","ayakubu80@outlook.com","Nigeria"), + ("Miguel Cardenas","euismod@yahoo.com","Peru"), + ("Luke Jansen","nibh@hotmail.edu","Netherlands"), + ("Roger Pettersen","nunc@protonmail.no","Norway"); +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 10 rows affected (0.02 sec) + Records: 10 Duplicates: 0 Warnings: 0 + ``` + +## Run a SELECT query + +SELECT queries retrieve data from one or more tables based on specified criteria. They are the most common type of query and can be used for various purposes, such as displaying, filtering, sorting, aggregating, or joining data. SELECT queries do not modify the data in the database but can affect the performance if the query involves large or complex datasets. + + + +```{.bash data-prompt="mysql>"} +mysql>SELECT id, name, email, country FROM employees WHERE country = 'Poland'; +``` + +??? example "Expected output" + + ```{.text .no-copy} + +----+-------------------+---------------------+---------+ + | id | name | email | country | + +----+-------------------+---------------------+---------+ + | 5 | Michal Brzezinski | magna@icloud.pl | Poland | + | 6 | Zofia Lis | zofial00@hotmail.pl | Poland | + +----+-------------------+---------------------+---------+ + 2 rows in set (0.00 sec) + ``` + +## Run an Update query + +UPDATE queries modify existing data in a table. They are used to change or correct the information stored in the database. UPDATE queries can update one or more columns and rows simultaneously, depending on the specified conditions. They may also fail if they violate any constraints or rules defined on the table. + + An example of an UPDATE query and then run a [SELECT](#select-query) with a WHERE clause to verify the update. + +```{.bash data-prompt="mysql>"} +mysql> UPDATE employees SET name = 'Zofia Niemec' WHERE id = 6; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 1 row affected (0.01 sec) + Rows matched: 1 Changed: 1 Warnings: 0 + ``` + +```{.bash data-prompt="mysql>"} +mysql> SELECT name FROM employees WHERE id = 6; +``` + +??? example "Expected output" + + ```{.text .no-copy} + +--------------+ + | name | + +--------------+ + | Zofia Niemec | + +--------------+ + 1 row in set (0.00 sec) + ``` + +## Run an INSERT query + +INSERT queries add new data to a table. They are used to populate the database with new information. INSERT queries can insert one or more rows at a time, depending on the syntax. The query may fail if it violates any constraints or rules defined on the table, such as primary keys, foreign keys, unique indexes, or triggers. + +Insert a row into a table and then run a [SELECT](#select-query) with a WHERE clause to verify the record was inserted. + +```{.bash data-prompt="mysql>"} +mysql> INSERT INTO `employees` (`name`,`email`,`country`) +VALUES +("Kenzo Sasaki","KenSasaki@outlook.com","Japan"); +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 1 row affected (0.01 sec) + ``` + +```{.bash data-prompt="mysql>"} +mysql> SELECT id, name, email, country FROM employees WHERE id = 11; +``` + +??? example "Expected output" + + ```{.text .no-copy} + +----+--------------+-----------------------+---------+ + | id | name | email | country | + +----+--------------+-----------------------+---------+ + | 11 | Kenzo Sasaki | KenSasaki@outlook.com | Japan | + +----+--------------+-----------------------+---------+ + 1 row in set (0.00 sec) + ``` + +## Run a Delete query + +DELETE queries remove existing data from a table. They are used to clean up the information no longer needed or relevant in the database. The DELETE queries can delete one or more rows at a time, depending on the specified conditions. They may also trigger cascading deletes on related tables if foreign key constraints are enforced. + +Delete a row in the table and run a [SELECT](#select-query) with a WHERE clause to verify the deletion. + +```{.bash data-prompt="mysql>"} +mysql> DELETE FROM employees WHERE id >= 11; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 1 row affected (0.01 sec) + ``` + +```{.bash data-prompt="mysql>"} +mysql> SELECT id, name, email, country FROM employees WHERE id > 10; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Empty set (0.00 sec) + ``` + +## Clean up + +The following steps do the following: + +* Exits the MySQL command client shell and the Docker container + +* Removes the Docker container and the Docker image + +* Removes the Docker volume. + +The steps are as follows: +{.power-number} + +1. To exit the MySQL command client shell we use `exit`. You can also use the `\q` or `quit` commands. The execution of the statement also closes the connection. + + * An example of exiting the MySQL command client shell and closing the connection. + + ```{.bash data-prompt="mysql>"} + mysql> exit + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + Bye + ``` + +2. You may want to remove the docker container and the image if they are no longer needed or to free up disk space. To remove a docker container, use the command `docker rm` followed by `psmysql`, the container ID or name. To remove a docker image, use the command `docker rmi` followed by `percona/percona-server:8.0.34`, the image ID or name and the tag. If you are running the ARM64 version of Percona Server, edit the Docker command to use the `8.0.34-26.1-aarch64` tag with `docker image rmi percona/percona-server:8.0.34-26.1-aarch64` + + * An example of removing a Docker container. + + ```{.bash data-prompt="$"} + $ docker container rm psmysql -f + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + psmysql + ``` + * An example of removing a Docker image. If running the ARM64 version of Percona Server, edit the Docker command to use the `8.0.34-26.1-aarch64` tag. This edit changes the command to `docker image rmi percona/percona-server:8.0.34-26.1-aarch64` + ``` + $ docker image rmi percona/percona-server:8.0.34 + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + Untagged: percona/percona-server:8.0.34 + Untagged: percona/percona-server@sha256:4944f9b365e0dc88f41b3b704ff2a02d1459fd07763d7d1a444b263db8498e1f + Deleted: sha256:b2588da614b1f382468fc9f44600863e324067a9cae57c204a30a2105d61d9d9 + Deleted: sha256:1ceaa6dc89e328281b426854a3b00509b5df13826a9618a09e819a830b752ebd + Deleted: sha256:77471692427a227eb16d06907357956c3bb43f0fdc3ecf6f8937e1acecae24fe + Deleted: sha256:8db06cc7b0430437edc7f118b139d2195cb65e2e8025f9a4517d16778f615384 + Deleted: sha256:e5a57a2fafec4ab9482240f28927651d56545c19626e344aceb8be3704c3c397 + Deleted: sha256:f86198f39b893674d44d424c958f23183bf919d2ced20e1f519714d0972d75ed + Deleted: sha256:db9672f7e12e374d5e9016b758a29d5444e8b0fd1246a6f1fc5c2b3c847dddcf + ``` + +3. Remove the docker volume if a container does not use the volume and you no longer need it. + + * An example of removing a Docker volume. + + ```{.bash data-prompt="$"} + $ docker volume rm myvol + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + myvol + ``` + +## Troubleshooting + +* Connection Refusal: Ensure Docker is running and the container is active. Verify port 3306 is accessible on the container's IP address. + +* Incorrect Credentials: Double-check the root password you set during container launch. + +* Data Loss: Always back up your data regularly outside the container volume. + +## Security measures + +* Strong Passwords: Utilize complex, unique passwords for the root user and any additional accounts created within the container. The alphanumeric password should contain at least 12 characters. The password should include uppercase and lowercase letters, numbers, and symbols. + +* Network Restrictions: Limit network access to the container by restricting firewall rules to only authorized IP addresses. + +* Periodic Updates: Regularly update the Percona Server image and Docker Engine to mitigate known vulnerabilities. + +* Data Encryption: Consider encrypting the data directory within the container volume for an additional layer of security. + +* Monitor Logs: Actively monitor container logs for suspicious activity or errors. + +Remember, responsible container management and robust security practices are crucial for safeguarding your MySQL deployment. By following these guidelines, you can leverage the benefits of Docker and Percona Server while prioritizing the integrity and security of your data. + +## Next step + +[Choose your next steps:material-arrow-right:](quickstart-next-steps.md){.md-button} + + +[Percona Server for MySQL documentation]: https://docs.percona.com/percona-server/8.4/ + +[percona/percona-server on the Docker Hub]: https://hub.docker.com/r/percona/percona-server diff --git a/docs/quickstart-overview.md b/docs/quickstart-overview.md index a00473cab0d..47e3eed1275 100644 --- a/docs/quickstart-overview.md +++ b/docs/quickstart-overview.md @@ -1,46 +1,36 @@ -# Quickstart guide for Percona Server for MySQL +# Quickstart - Overview -Percona Server for MySQL is a freely available, fully compatible, enhanced, and open source drop-in replacement for any MySQL database. It provides superior and optimized performance, greater scalability and availability, enhanced backups, increased visibility, and instrumentation. -Percona Server for MySQL is trusted by thousands of enterprises to provide better performance and concurrency for their most demanding workloads. +Percona Server for MySQL is a freely available, fully compatible, enhanced, and open source drop-in replacement for any MySQL database and provides enterprise-grade features in security, availability, data management, visibility, instrumentation, and performance. -## Install Percona Server for MySQL +To start with Percona Server for MySQL quickly, this Quickstart guide focuses on either using Docker, or installing with APT or YUM. -You can install Percona Server for MySQL using different methods. +You can explore alternative installation options in the [Install] section of the Percona Server for MySQL documentation. -* [Use the Percona Repositories](installation.md) -* [Use APT](apt-repo.md) -* [Use YUM](yum-repo.md) -* [Use binary tarballs](binary-tarball-install.md) -* [Use Docker](docker.md) +## Purpose of the Quickstart -## For backups and restores +This document guides you through the initial setup process, including setting a root password in either APT or YUM, creating a database. -Percona XtraBackup (PXB) is a 100% open source backup solution for all versions of Percona Server for MySQL and MySQL® that performs online non-blocking, tightly compressed, highly secure full backups on transactional systems. Maintain fully available applications during planned maintenance windows with Percona XtraBackup. +You can also do the following: -[Install Percona XtraBackup](https://docs.percona.com/percona-xtrabackup/innovation-release/installation.html) +* [Download and install Percona Server for MySQL packages for your operating system](installation.md) -## For Monitoring and Management +* Work with [the Quickstart for the Percona Operator for MySQL based on the Percona Server for MySQL using Helm] or [the Quickstart for the Percona Operator for MySQL based on the Percona Server for MySQL using Minikube] to find out more about the Percona Operator. -Percona Monitoring and Management (PMM )monitors and provides actionable performance data for MySQL variants, including Percona Server for MySQL, Percona XtraDB Cluster, Oracle MySQL Community Edition, Oracle MySQL Enterprise Edition, and MariaDB. PMM captures metrics and data for the InnoDB, XtraDB, and MyRocks storage engines, and has specialized dashboards for specific engine details. +## Steps for first-time users -[Install PMM and connect your MySQL instances to it](https://docs.percona.com/percona-monitoring-and-management/get-started/index.html). +The following guides walk you through the setup process and working with a database for a developer. Select the installation method that works best in your environment. -## For high availability +## Next steps -Percona XtraDB Cluster (PXC) is a 100% open source, enterprise-grade, highly available clustering solution for MySQL multi-source setups based on Galera. PXC helps enterprises minimize unexpected downtime and data loss, reduce costs, and improve performance and scalability of your database environments supporting your critical business applications in the most demanding public, private, and hybrid cloud environments. +[Run Percona Server for MySQL 8.4 in a Docker container:material-arrow-right:](quickstart-docker.md){.md-button} -[Percona XtraDB Cluster Quick start guide](https://docs.percona.com/percona-xtradb-cluster/8.0/quickstart-overview.html) +[Install using APT:material-arrow-right:](quickstart-apt.md){.md-button} -## Operators +[Install using YUM:material-arrow-right:](quickstart-yum.md){.md-button} -Percona Operator for MySQL and Percona Operator for MySQL based on Percona XtraDB Cluster are tools designed to simplify the deployment, management, and scaling of MySQL and Percona XtraDB Cluster (PXC) instances in Kubernetes environments. These operators automate various database tasks such as backups, recovery, and updates, ensuring high availability and reliability. They provide robust features like automated failover, self-healing, and seamless scaling, which help maintain optimal database performance and reduce manual intervention. By leveraging Kubernetes' orchestration capabilities, these operators enhance the efficiency and resilience of MySQL and PXC deployments, making them well-suited for modern cloud-native applications. +[Choose your next steps:material-arrow-right:](quickstart-next-steps.md){.md-button} -[Percona Operator for MySQL Documentation](https://docs.percona.com/percona-operator-for-mysql/ps/) -[Percona Operator for MySQL based on Percona XtraDB Cluster](https://docs.percona.com/percona-operator-for-mysql/pxc/) +[the Quickstart for the Percona Operator for MySQL based on the Percona Server for MySQL using Helm]: https://docs.percona.com/percona-operator-for-mysql/ps/helm.html -## Cloud-native database services - -Percona Everest is an open-source cloud-native database platform that helps developers deploy code faster, scale deployments rapidly, and reduce database administration overhead while regaining control over their data, database configuration, and DBaaS costs. - -[Percona Everest](https://docs.percona.com/everest/index.html) \ No newline at end of file +[the Quickstart for the Percona Operator for MySQL based on the Percona Server for MySQL using Minikube]: https://docs.percona.com/percona-operator-for-mysql/ps/minikube.html \ No newline at end of file diff --git a/docs/quickstart-yum.md b/docs/quickstart-yum.md new file mode 100644 index 00000000000..a416ff7e83d --- /dev/null +++ b/docs/quickstart-yum.md @@ -0,0 +1,550 @@ +# Install Percona Server for MySQL and create a database with Oracle Linux + +Use the [Percona repositories] to install using YUM. + +## Prerequisits + +* Either use `sudo` or run as root + +* Stable Internet access + +## Installation steps + +The examles of the "expected output" depend on the operating system. The following examples are based on Oracle Linux 9.3. +{.power-number} + +1. Use the YUM package manager to install `percona-release`. + + ```{.bash data-prompt="$"} + $ sudo yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + Oracle Linux 9 BaseOS Latest (x86_64) 7.0 MB/s | 20 MB 00:02 + Oracle Linux 9 Application Stream Packages (x86_64) 7.3 MB/s | 28 MB 00:03 + Oracle Linux 9 UEK Release 7 (x86_64) 6.7 MB/s | 27 MB 00:04 + Last metadata expiration check: 0:00:04 ago on Fri 16 Feb 2024 12:34:26 PM UTC. + percona-release-latest.noarch.rpm 37 kB/s | 20 kB 00:00 + Dependencies resolved. + ... + * Enabling the Percona Original repository + <*> All done! + * Enabling the Percona Release repository + <*> All done! + The percona-release package now contains a percona-release script that can enable additional repositories for our newer products. + + For example, to enable the Percona Server 8.0 repository use: + + percona-release setup ps80 + + Note: To avoid conflicts with older product versions, the percona-release setup command may disable our original repository for some products. + + For more information, please visit: + https://www.percona.com/doc/percona-repo-config/percona-release.html + + + Verifying : percona-release-1.0-27.noarch 1/1 + + Installed: + percona-release-1.0-27.noarch + + Complete! + ``` + +2. Use the `percona-release` tool to setup the repository for Percona Server for MySQL 8.0. + + ```{.bash data-prompt="$"} + $ sudo percona-release setup ps-80 + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + * Disabling all Percona Repositories + On Red Hat 8 systems it is needed to disable the following DNF module(s): mysql to install Percona-Server + Do you want to disable it? [y/N] y + Disabling dnf module... + Percona Release release/noarch YUM repository 2.7 kB/s | 1.8 kB 00:00 + Unable to resolve argument mysql + Error: Problems in request: + missing groups or modules: mysql + DNF mysql module was disabled + * Enabling the Percona Server 8.0 repository + * Enabling the Percona Tools repository + <*> All done! + ``` + +3. Enable the `ps-80 release` repository. + + ```{.bash data-prompt="$"} + $ sudo percona-release enable ps-80 release + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + * Enabling the Percona Server 8.0 repository + <*> All done! + ``` + +4. Install the latest version of Percona Server for MySQL 8.0. This installation may take some time. + + ```{.bash data-prompt="$"} + $ sudo yum install -y percona-server-server + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + Percona Server 8.0 release/x86_64 YUM repository 1.0 MB/s | 2.3 MB 00:02 + Percona Tools release/x86_64 YUM repository 761 kB/s | 1.1 MB 00:01 + Last metadata expiration check: 0:00:01 ago on Fri 16 Feb 2024 03:07:45 PM UTC. + Dependencies resolved. + … + perl-vars-1.05-480.el9.noarch + + Complete! + ``` + +5. Check the status of the mysql service and restart if needed. + + ```{.bash data-prompt="$"} + $ sudo systemctl status mysql + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + ○ mysqld.service - MySQL Server + Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled) + Active: inactive (dead) + Docs: man:mysqld(8) + http://dev.mysql.com/doc/refman/en/using-systemd.html + ``` + + ```{.bash data-prompt="$"} + $ sudo systemctl restart mysql + ``` + + This command has no output. + +6. Percona Server for MySQL generates a temporary password during installation. You must have the service running to access the log. + + ```{.bash data-prompt="$"} + $ sudo grep 'temporary password' /var/log/mysqld.log + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + 2024-02-12T16:05:03.969449Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: [random-generated-password] + ``` + +7. Log in to the server. Use the password retrieved by the `grep` command. You can type the password or copy-and-paste. You do not see the characters in the password as you type. + + ```{.bash data-prompt="$"} + $ mysql -uroot -p + Enter password: + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + Welcome to the MySQL monitor. Commands end with ; or \g. + Your MySQL connection id is 8 + Server version: {{tag}} Percona Server (GPL), Release '27', Revision '2f8eeab2'$ + + Copyright (c) 2009-{{year_tag}} Percona LLC and/or its affiliates + Copyright (c) 2000, {{year_tag}}, Oracle and/or its affiliates. + + Oracle is a registered trademark of Oracle Corporation and/or its + affiliates. Other names may be trademarks of their respective + owners. + + Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + + mysql> + ``` + +8. The temporary password must be replaced. Run the ALTER USER command tochange the password for the root user. Remember or save the new password.You will need it to log into the server in the next step. + + ```{.bash data-prompt="mysql>"} + mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '[your password]'; + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + Query OK, 0 rows affected (0.01 sec) + ``` + +9. Log out of the server. to verify that the password has changed. + + ```{.bash data-prompt="mysql>"} + mysql> exit + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + Bye + ``` + +10. Log into the server with the new password to verify that the password has changed. + + + ```{.bash data-prompt="$"} + $ mysql -uroot -p + Enter password: + ``` + + ??? example "Expected output" + + ```{.text .no-copy} + Welcome to the MySQL monitor. Commands end with ; or \g. + Your MySQL connection id is 8 + Server version: {{tag}} Percona Server (GPL), Release '27', Revision '2f8eeab2'$ + + Copyright (c) 2009-{{year_tag}} Percona LLC and/or its affiliates + Copyright (c) 2000, {{year_tag}}, Oracle and/or its affiliates. + + Oracle is a registered trademark of Oracle Corporation and/or its + affiliates. Other names may be trademarks of their respective + owners. + + Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + + mysql> + ``` + +## Create a database + +??? Example "Benefits and what to watch out for when creating databases and tables" + + Creating a database and table has the following benefits: + + - Store and organize your data in a structured and consistent way. + - Query and manipulate your data using SQL. + - Enforce data integrity and security using constraints, triggers, views, roles, and permissions. + - Optimize your data access and performance using indexes, partitions, caching, and other techniques. + + When you create a table, design your database schema carefully, changing it later may be difficult and costly. You should experiment with concurrency, transactions, locking, isolation, and other issues that may arise when multiple users access the same data. You must backup and restore your data regularly, as data loss or corruption may occur due to hardware failures, human errors, or malicious attacks. + +To create a database, use the `CREATE DATABASE` statement. You can optionally specify the character set and collation for the database in the statement. After the database is created, select the database using the `USE` statement or the `-D` option in the MySQL client. + +```{.bash data-prompt="mysql>"} +mysql> CREATE DATABASE mydb; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 1 row affected (0.01 sec) + ``` + +```{.bash data-prompt="mysql>"} +mysql> use mydb; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Database changed + ``` + +## Create a table + +Create a table using the `CREATE TABLE` statement. You can specify the values for each column or use the DEFAULT keyword for columns with default values, data types, constraints, indexes, and other options. + +```{.bash data-prompt="mysql>"} +mysql> CREATE TABLE `employees` ( + `id` mediumint(8) unsigned NOT NULL auto_increment, + `name` varchar(255) default NULL, + `email` varchar(255) default NULL, + `country` varchar(100) default NULL, + PRIMARY KEY (`id`) +) AUTO_INCREMENT=1; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 0 rows affected, 1 warning (0.03 sec) + ``` + +## Insert data into the table + +Insert data into the table using the `INSERT INTO` SQL statement. This statement adds multiple records into a table in one statement. + + +```{.bash data-prompt="mysql>"} +mysql> INSERT INTO `employees` (`name`,`email`,`country`) +VALUES + ("Erasmus Richardson","posuere.cubilia.curae@outlook.net","England"), + ("Jenna French","rhoncus.donec@hotmail.couk","Canada"), + ("Alfred Dejesus","interdum@aol.org","Austria"), + ("Hamilton Puckett","dapibus.quam@outlook.com","Canada"), + ("Michal Brzezinski","magna@icloud.pl","Poland"), + ("Zofia Lis","zofial00@hotmail.pl","Poland"), + ("Aisha Yakubu","ayakubu80@outlook.com","Nigeria"), + ("Miguel Cardenas","euismod@yahoo.com","Peru"), + ("Luke Jansen","nibh@hotmail.edu","Netherlands"), + ("Roger Pettersen","nunc@protonmail.no","Norway"); +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 10 rows affected (0.02 sec) + Records: 10 Duplicates: 0 Warnings: 0 + ``` + +## Run a SELECT query + +SELECT queries retrieve data from one or more tables based on specified criteria. They are the most common type of query and can be used for various purposes, such as displaying, filtering, sorting, aggregating, or joining data. SELECT queries do not modify the data in the database but can affect the performance if the query involves large or complex datasets. + + + +```{.bash data-prompt="mysql>"} +mysql>SELECT id, name, email, country FROM employees WHERE country = 'Poland'; +``` + +??? example "Expected output" + + ```{.text .no-copy} + +----+-------------------+---------------------+---------+ + | id | name | email | country | + +----+-------------------+---------------------+---------+ + | 5 | Michal Brzezinski | magna@icloud.pl | Poland | + | 6 | Zofia Lis | zofial00@hotmail.pl | Poland | + +----+-------------------+---------------------+---------+ + 2 rows in set (0.00 sec) + ``` + +## Run an Update query + +UPDATE queries modify existing data in a table. They are used to change or correct the information stored in the database. UPDATE queries can update one or more columns and rows simultaneously, depending on the specified conditions. They may also fail if they violate any constraints or rules defined on the table. + + An example of an UPDATE query and then run a [SELECT](#select-query) with a WHERE clause to verify the update. + +```{.bash data-prompt="mysql>"} +mysql> UPDATE employees SET name = 'Zofia Niemec' WHERE id = 6; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 1 row affected (0.01 sec) + Rows matched: 1 Changed: 1 Warnings: 0 + ``` + +```{.bash data-prompt="mysql>"} +mysql> SELECT name FROM employees WHERE id = 6; +``` + +??? example "Expected output" + + ```{.text .no-copy} + +--------------+ + | name | + +--------------+ + | Zofia Niemec | + +--------------+ + 1 row in set (0.00 sec) + ``` + +## Run an INSERT query + +INSERT queries add new data to a table. They are used to populate the database with new information. INSERT queries can insert one or more rows at a time, depending on the syntax. The query may fail if it violates any constraints or rules defined on the table, such as primary keys, foreign keys, unique indexes, or triggers. + +Insert a row into a table and then run a [SELECT](#select-query) with a WHERE clause to verify the record was inserted. + +```{.bash data-prompt="mysql>"} +mysql> INSERT INTO `employees` (`name`,`email`,`country`) +VALUES +("Kenzo Sasaki","KenSasaki@outlook.com","Japan"); +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 1 row affected (0.01 sec) + ``` + +```{.bash data-prompt="mysql>"} +mysql> SELECT id, name, email, country FROM employees WHERE id = 11; +``` + +??? example "Expected output" + + ```{.text .no-copy} + +----+--------------+-----------------------+---------+ + | id | name | email | country | + +----+--------------+-----------------------+---------+ + | 11 | Kenzo Sasaki | KenSasaki@outlook.com | Japan | + +----+--------------+-----------------------+---------+ + 1 row in set (0.00 sec) + ``` + +## Run a Delete query + +DELETE queries remove existing data from a table. They are used to clean up the information no longer needed or relevant in the database. The DELETE queries can delete one or more rows at a time, depending on the specified conditions. They may also trigger cascading deletes on related tables if foreign key constraints are enforced. + +Delete a row in the table and run a [SELECT](#select-query) with a WHERE clause to verify the deletion. + +```{.bash data-prompt="mysql>"} +mysql> DELETE FROM employees WHERE id >= 11; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Query OK, 1 row affected (0.01 sec) + ``` + +```{.bash data-prompt="mysql>"} +mysql> SELECT id, name, email, country FROM employees WHERE id > 10; +``` + +??? example "Expected output" + + ```{.text .no-copy} + Empty set (0.00 sec) + ``` + +## Troubleshooting: + +Installation: + +* Verify repository is enabled: `sudo yum repolist` + +* Check for package conflicts: `sudo yum deplist percona-server-server` + +* Consult package logs: `sudo journalctl -u yum` + +MySQL startup: + +* Review system logs: `sudo journalctl -u mysqld` + +* Check configuration files: /etc/my.cnf + +## Security Steps: + +* Keep software updated: `sudo yum update` regularly. + +* Strong root password: Set a complex, unique password using [`mysql_secure_installation`](#secure-the-installation). + +* Disable unused accounts and databases: Remove unnecessary elements. + +* Monitor Server Activity: Employ tools, like [Percona Monitoring and Management], and logs to monitor server activity for suspicious behavior. + +* Backup data regularly: Ensure robust backups for disaster recovery. + +## Secure the installation + +You can increase the security of MySQL by running`sudo mysql_secure installation`. + +After installing MySQL, you should run the `mysql_secure_installation` script to improve the security of your database server. This script helps you perform several important tasks, such as: + +- Set a password for the root user + +- Select a level for the password validation policy + +- Remove anonymous users + +- Disable root login remotely + +- Remove the test database + +- Reload the privilege table to ensure all changes take effect immediately + +By running this script, you can prevent unauthorized access to your server and protect your data from potential threats. + +```{.bash data-prompt="$"} +$ sudo mysql_secure_installation +``` + +??? example "Expected output" + + ```{.text .no-copy} + Securing the MySQL server deployment. + + Enter password for user root: + + VALIDATE PASSWORD COMPONENT can be used to test passwords + and improve security. It checks the strength of password + and allows the users to set only those passwords which are + secure enough. Would you like to setup VALIDATE PASSWORD component? + + Press y|Y for Yes, any other key for No: + + There are three levels of password validation policy: + + LOW Length >= 8 + MEDIUM Length >= 8, numeric, mixed case, and special characters + STRONG Length >= 8, numeric, mixed case, special characters and dictionary file + + Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1 + Using existing password for root. + + Estimated strength of the password: 0 + Change the password for root ? ((Press y|Y for Yes, any other key for No) : + + New password: + + Re-enter new password: + + Estimated strength of the password: 100 + Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : + By default, a MySQL installation has an anonymous user, + allowing anyone to log into MySQL without having to have + a user account created for them. This is intended only for + testing, and to make the installation go a bit smoother. + You should remove them before moving into a production + environment. + + Remove anonymous users? (Press y|Y for Yes, any other key for No) : + Success. + + + Normally, root should only be allowed to connect from + 'localhost'. This ensures that someone cannot guess at + the root password from the network. + + Disallow root login remotely? (Press y|Y for Yes, any other key for No) : + Success. + + By default, MySQL comes with a database named 'test' that + anyone can access. This is also intended only for testing, + and should be removed before moving into a production + environment. + + + Remove test database and access to it? (Press y|Y for Yes, any other key for No) : + - Dropping test database... + Success. + + - Removing privileges on test database... + Success. + + Reloading the privilege tables will ensure that all changes + made so far will take effect immediately. + + Reload privilege tables now? (Press y|Y for Yes, any other key for No) : + Success. + + All done! + ``` + + + +## Next step + +[Choose your next steps:material-arrow-right:](quickstart-next-steps.md){.md-button} + + + +[Percona Monitoring and Management]: https://docs.percona.com/percona-monitoring-and-management +[Percona repositories]: percona-release.md diff --git a/mkdocs-base.yml b/mkdocs-base.yml index 42a5df3f49e..1096a832ca8 100644 --- a/mkdocs-base.yml +++ b/mkdocs-base.yml @@ -182,8 +182,12 @@ nav: - trigger-updates.md - udf-percona-toolkit.md - utility-user.md - - Quickstart guide: - - quickstart-overview.md + - Quickstart: + - Quickstart - Overview: quickstart-overview.md + - Quickstart - Run Percona Server for MySQL container images with Docker: quickstart-docker.md + - Quickstart - Install Percona Server for MySQL and create a database on Ubuntu: quickstart-apt.md + - Quickstart - Install Percona Server for MySQL and create a database on Oracle Linux: quickstart-yum.md + - Quickstart - Next steps: quickstart-next-steps.md - Install: - Install Percona Server for MySQL from repositories: installation.md - Before you start: diff --git a/variables.yml b/variables.yml index 000631f9de0..f3e4de55bbb 100644 --- a/variables.yml +++ b/variables.yml @@ -6,4 +6,8 @@ vers: '8.4' # we are going to use it instead of version pkg: 'ps-84-lts' release_date: '2024-08-28' title_date: '2024-08-28' +pro_release: '8.4.2-2' +tag: '8.4.2' +arm_tag: '8.4.2-aarch64' +year_tag: '2024'