Skip to content

MySQL Help

MySQL Installation Instructions

MySQL (OPTIONAL)

(NOTE: If you're using this test framework from a local development machine and don't plan on writing to a MySQL DB from your local test runs, you can skip this step.)

Linux (Ubuntu):
sudo apt update
sudo apt install mysql-server
sudo mysql_secure_installation
sudo mysql -e 'CREATE DATABASE IF NOT EXISTS test_db;'
sudo mysql -h 127.0.0.1 -u root test_db < seleniumbase/core/create_db_tables.sql
sudo service mysql restart

To change the password:

mysqladmin -u root -p'OLD_PASSWORD' password NEW_PASSWORD
sudo service mysql restart
MacOS
brew install mysql

Then you'll need to start the MySQL service:

brew services start mysql

Continue with additional steps below to setup your DB.

Windows

Download MySQL here Follow the steps from the MySQL Downloads page.

Continue with additional steps below to setup your DB.

Access your MySQL DB

If you want a visual tool to help make your MySQL life easier, try MySQL Workbench.

Prepare your MySQL DB

You can use the create_db_tables.sql file to create the necessary tables for storing test data.

Configure your MySQL DB for SeleniumBase

You'll want to update your settings.py file with your MySQL DB credentials so that tests can write to the database when they run.

Allow tests to write to your MySQL database

Add the --with-db_reporting argument on the command line when you want tests to write to your MySQL database. Example:

pytest my_first_test.py --with-db_reporting