Skip to content

Commit 308b89f

Browse files
committed
Update the MySQL ReadMe
1 parent f8f0957 commit 308b89f

File tree

1 file changed

+49
-17
lines changed

1 file changed

+49
-17
lines changed

help_docs/mysql_installation.md

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,39 @@
33
## MySQL Installation Instructions
44

55

6-
#### [MySQL](http://www.mysql.com/) (OPTIONAL)
6+
### [MySQL](http://www.mysql.com/) (OPTIONAL)
77

8-
(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.)
8+
(NOTE: If you don't plan on using the SeleniumBase MySQL DB feature, then you can skip this section.)
9+
10+
--------
11+
12+
### GitHub Actions Ubuntu Linux MySQL Setup:
13+
14+
```bash
15+
sudo /etc/init.d/mysql start
16+
mysql -e 'CREATE DATABASE IF NOT EXISTS test_db;' -uroot -proot
17+
wget https://raw.githubusercontent.com/seleniumbase/SeleniumBase/master/seleniumbase/core/create_db_tables.sql
18+
sudo mysql -h 127.0.0.1 -uroot -proot test_db < create_db_tables.sql
19+
sudo mysql -e 'ALTER USER "root"@"localhost" IDENTIFIED BY "test";' -uroot -proot
20+
sudo service mysql restart
21+
```
22+
23+
Have SeleniumBase tests write to the MySQL DB:
24+
25+
```bash
26+
pytest --with-db_reporting
27+
```
28+
29+
Query MySQL DB Results:
30+
31+
```bash
32+
mysql -e 'select test_address,browser,state,start_time,runtime from test_db.test_run_data;' -uroot -ptest
33+
```
34+
35+
--------
36+
37+
### Standard Ubuntu Linux MySQL Setup:
938

10-
##### Linux (Ubuntu):
1139
```bash
1240
sudo apt update
1341
sudo apt install mysql-server
@@ -18,45 +46,49 @@ sudo service mysql restart
1846
```
1947

2048
To change the password:
49+
2150
```bash
2251
mysqladmin -u root -p'OLD_PASSWORD' password NEW_PASSWORD
2352
sudo service mysql restart
2453
```
2554

26-
##### MacOS:
55+
### MacOS MySQL Setup:
56+
2757
```bash
2858
brew install mysql
2959
```
3060

31-
Then you'll need to start the MySQL service:
61+
Then start the MySQL service:
62+
3263
```bash
3364
brew services start mysql
3465
```
3566

36-
Continue with additional steps below to setup your DB.
67+
(Continue with additional steps below to set up your DB.)
68+
69+
### Windows MySQL Setup:
3770

38-
##### Windows:
3971
[Download MySQL here](http://dev.mysql.com/downloads/windows/)
4072
Follow the steps from the MySQL Downloads page.
4173

42-
Continue with additional steps below to setup your DB.
74+
(Continue with additional steps below to set up your DB.)
4375

44-
#### Access your MySQL DB
76+
### Access your MySQL DB:
4577

4678
If you want a visual tool to help make your MySQL life easier, [try MySQL Workbench](http://dev.mysql.com/downloads/workbench/).
4779

48-
#### Prepare your MySQL DB
80+
### Prepare your MySQL DB:
81+
82+
Use the [create_db_tables.sql](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/create_db_tables.sql) file to create the necessary tables for storing test data.
4983

50-
You can use the [create_db_tables.sql](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/create_db_tables.sql) file to create the necessary tables for storing test data.
84+
### Configure your MySQL DB for SeleniumBase:
5185

52-
#### Configure your MySQL DB for SeleniumBase
86+
Update your [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) file with your MySQL DB credentials so that tests can write to the database when they run.
5387

54-
You'll want to update your [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) file with your MySQL DB credentials so that tests can write to the database when they run.
88+
### Have SeleniumBase tests write to your MySQL DB:
5589

56-
#### Allow tests to write to your MySQL database
90+
Add the ``--with-db_reporting`` argument on the command line when you want tests to write to your MySQL database. Example:
5791

58-
Add the ``--with-db_reporting`` argument on the command line when you want tests to write to your MySQL database.
59-
Example:
6092
```bash
61-
pytest my_first_test.py --with-db_reporting
93+
pytest --with-db_reporting
6294
```

0 commit comments

Comments
 (0)