Skip to content

Instantly share code, notes, and snippets.

@elopio elopio/

Last active Sep 6, 2018
What would you like to do?
MySQL snap testing

Smoke tests for the MySQL snap

(based on )

First, install the snap:

$ sudo snap install mysql --channel=8.0/beta

Print the help:

MySQL Snap Image

= MySQL Snap Image =
The MySQL snap image is an experimental release of MySQL for the snap universal Linux package system (
This image should be used for testing only, and is not suitable for a production environment.

== Commands ==

Start the server:

$ mysql.startup
Generating config file in /home/elopio/snap/mysql/common/conf/my.cnf...
Initializing new database in /home/elopio/snap/mysql/common/data...
2017-01-05T05:19:05.178633Z 4 [Note] A temporary password is generated for root@localhost: $temp_password
Starting server...

The server will keep running in that terminal, so open another one.

Open the monitor: (Use the $temp_password printed by mysql.startup)

$ mysql.client -uroot -p
Using config file: /home/elopio/snap/mysql/common/conf/my.cnf
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 8.0.0-dmr

Print the monitor help:

mysql> help

For information about MySQL products and services, visit:
For developer information, including the MySQL Reference Manual, visit:
To buy MySQL Enterprise support, training, or other products, visit:

List of all MySQL commands:

Reset your user password:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Hola123*';
Query OK, 0 rows affected (0.02 sec)

Run a query:

| 8.0.0-dmr | 2017-01-04   |
1 row in set (0.00 sec)

Show databases:

| Database           |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
4 rows in set (0.00 sec)

Create a database:

mysql> CREATE DATABASE menagerie;
Query OK, 1 row affected (0.05 sec)

Switch database:

mysql> USE menagerie
Database changed

Create a table:

mysql> CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20), species VARCHAR(20), sex CHAR(1), birth DATE, death DATE);
Query OK, 0 rows affected (0.23 sec)

Show tables:

| Tables_in_menagerie |
| pet                 |
1 row in set (0.00 sec)

Insert a row:

mysql> INSERT INTO pet VALUES ('Puffball','Diane','hamster','f','1999-03-30',NULL);
Query OK, 1 row affected (0.21 sec)

Select a row:

mysql> SELECT * FROM pet WHERE name = 'Puffball';
| name     | owner | species | sex  | birth      | death |
| Puffball | Diane | hamster | f    | 1999-03-30 | NULL  |
1 row in set (0.00 sec)

Quit the monitor:

mysql> QUIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.