|
| 1 | +--- |
| 2 | +title: Validate MySQL on Azure Cobalt 100 Arm64 VMs |
| 3 | +weight: 6 |
| 4 | + |
| 5 | +### FIXED, DO NOT MODIFY |
| 6 | +layout: learningpathall |
| 7 | +--- |
| 8 | + |
| 9 | +## Run a functional test of MySQL on Azure Cobalt 100 |
| 10 | + |
| 11 | +After installing MySQL on your Arm64 virtual machine, you can perform simple baseline testing to validate that MySQL runs correctly and produces the expected output. |
| 12 | + |
| 13 | +### Start MySQL |
| 14 | + |
| 15 | +Make sure MySQL is running: |
| 16 | + |
| 17 | +```console |
| 18 | +sudo /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data & |
| 19 | +``` |
| 20 | +Starts the MySQL server in safe mode using **/usr/local/mysql/data** as the data directory, running in the background. |
| 21 | + |
| 22 | +### Connect to MySQL |
| 23 | + |
| 24 | +```console |
| 25 | +mysql -u root -p |
| 26 | +``` |
| 27 | +Opens the MySQL client and connects as the root user, prompting you to enter the root password. |
| 28 | + |
| 29 | +### Create, show and use Database |
| 30 | + |
| 31 | +```sql |
| 32 | +CREATE DATABASE baseline_test; |
| 33 | +SHOW DATABASES; |
| 34 | +USE baseline_test; |
| 35 | +SELECT DATABASE(); |
| 36 | +``` |
| 37 | +- `CREATE DATABASE baseline_test;` - Creates a new database named baseline_test. |
| 38 | +- `SHOW DATABASES;` - Lists all available databases. |
| 39 | +- `USE baseline_test;` - Switches to the new database. |
| 40 | +- `SELECT DATABASE();` - Confirms the current database in use. |
| 41 | + |
| 42 | +You should see output similar to: |
| 43 | + |
| 44 | +```output |
| 45 | +mysql> CREATE DATABASE baseline_test; |
| 46 | +Query OK, 1 row affected (0.02 sec) |
| 47 | +
|
| 48 | +mysql> SHOW DATABASES; |
| 49 | ++--------------------+ |
| 50 | +| Database | |
| 51 | ++--------------------+ |
| 52 | +| baseline_test | |
| 53 | +| information_schema | |
| 54 | +| mysql | |
| 55 | +| performance_schema | |
| 56 | +| sys | |
| 57 | ++--------------------+ |
| 58 | +5 rows in set (0.00 sec) |
| 59 | +
|
| 60 | +mysql> SELECT DATABASE(); |
| 61 | ++---------------+ |
| 62 | +| DATABASE() | |
| 63 | ++---------------+ |
| 64 | +| baseline_test | |
| 65 | ++---------------+ |
| 66 | +1 row in set (0.00 sec) |
| 67 | +``` |
| 68 | +You created a new database named **baseline_test**, verified its presence with `SHOW DATABASES`, and confirmed it is the active database using `SELECT DATABASE()`. |
| 69 | + |
| 70 | +### Create and show Table |
| 71 | + |
| 72 | +```sql |
| 73 | +CREATE TABLE test_table ( |
| 74 | + id INT AUTO_INCREMENT PRIMARY KEY, |
| 75 | + name VARCHAR(50), |
| 76 | + value INT |
| 77 | +); |
| 78 | +``` |
| 79 | + |
| 80 | +- `CREATE TABLE` - Defines a new table named test_table. |
| 81 | + - `id` - Primary key with auto-increment. |
| 82 | + - `name` - String field up to 50 characters. |
| 83 | + - `value` - Integer field. |
| 84 | +- `SHOW TABLES;` - Lists all tables in the current database. |
| 85 | + |
| 86 | +You should see output similar to: |
| 87 | + |
| 88 | +```output |
| 89 | +Query OK, 0 rows affected (0.05 sec) |
| 90 | +
|
| 91 | +mysql> SHOW TABLES; |
| 92 | ++-------------------------+ |
| 93 | +| Tables_in_baseline_test | |
| 94 | ++-------------------------+ |
| 95 | +| test_table | |
| 96 | ++-------------------------+ |
| 97 | +1 row in set (0.00 sec) |
| 98 | +``` |
| 99 | +You successfully created the table **test_table** in the `baseline_test` database and verified its existence using `SHOW TABLES`. |
| 100 | + |
| 101 | +### Insert Sample Data |
| 102 | + |
| 103 | +```sql |
| 104 | +INSERT INTO test_table (name, value) |
| 105 | +VALUES |
| 106 | +('Alice', 100), |
| 107 | +('Bob', 200), |
| 108 | +('Charlie', 300); |
| 109 | +``` |
| 110 | +- `INSERT INTO test_table (name, value)` - Specifies which table and columns to insert into. |
| 111 | +- `VALUES` - Provides three rows of data. |
| 112 | + |
| 113 | +After inserting, you can check the data with: |
| 114 | + |
| 115 | +```sql |
| 116 | +SELECT * FROM test_table; |
| 117 | +``` |
| 118 | +- `SELECT *` - Retrieves all columns. |
| 119 | +- `FROM test_table` - Selects from the test_table. |
| 120 | + |
| 121 | +You should see output similar to: |
| 122 | + |
| 123 | +```output |
| 124 | +mysql> SELECT * FROM test_table; |
| 125 | ++----+---------+-------+ |
| 126 | +| id | name | value | |
| 127 | ++----+---------+-------+ |
| 128 | +| 1 | Alice | 100 | |
| 129 | +| 2 | Bob | 200 | |
| 130 | +| 3 | Charlie | 300 | |
| 131 | ++----+---------+-------+ |
| 132 | +3 rows in set (0.00 sec) |
| 133 | +``` |
| 134 | + |
| 135 | +The functional test was successful — the **test_table** contains three rows (**Alice, Bob, and Charlie**) with their respective values, confirming MySQL is working |
| 136 | +correctly. |
| 137 | + |
0 commit comments