Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit f50900a

Browse files
author
Antonios Papadakis
committed
Add Script that ONLY Starts MySQL 8
macOS
1 parent 718afef commit f50900a

File tree

4 files changed

+116
-0
lines changed

4 files changed

+116
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
NC='\033[0m' # No Color
4+
YELLOW='\033[1;33m'
5+
RED='\033[1;31m'
6+
7+
function SQLSetup() {
8+
read -p 'Where would you like your MySQL server files to reside on your local machine (absolute path, must exist)? ' MYSQLFOLDERLOCATION
9+
ls "$MYSQLFOLDERLOCATION"
10+
ISMYSQLFOLDERPRESENT=$?
11+
if [ -z "$MYSQLFOLDERLOCATION" ]; then
12+
echo -e "${YELLOW}The path of the MySQL file folder cannot be empty. Please choose a folder.${NC}"
13+
SQLSetup
14+
elif [ "$ISMYSQLFOLDERPRESENT" = 1 ]; then
15+
echo -e "$MYSQLFOLDERLOCATION" ${RED}does not exist, please choose another folder.${NC}
16+
SQLSetup
17+
fi
18+
}
19+
20+
SQLSetup
21+
22+
if [ ! "$(docker ps -q -f name=mysql80)" ]; then
23+
if [ "$(docker ps -aq -f status=exited -f name=mysql80)" ]; then
24+
# cleanup
25+
docker rm mysql80
26+
fi
27+
# run your container
28+
docker run -d -p 3306:3306 -p 33060:33060 --volume "$MYSQLFOLDERLOCATION":/var/lib/mysql --name mysql80 frostedflakez/php-mysql-webserver:0.9-beta.3-mysql-latest-8.0
29+
fi
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
NC='\033[0m' # No Color
4+
YELLOW='\033[1;33m'
5+
RED='\033[1;31m'
6+
7+
function SQLSetup() {
8+
read -p 'Where would you like your MySQL server files to reside on your local machine (absolute path, must exist)? ' MYSQLFOLDERLOCATION
9+
ls "$MYSQLFOLDERLOCATION"
10+
ISMYSQLFOLDERPRESENT=$?
11+
if [ -z "$MYSQLFOLDERLOCATION" ]; then
12+
echo -e "${YELLOW}The path of the MySQL file folder cannot be empty. Please choose a folder.${NC}"
13+
SQLSetup
14+
elif [ "$ISMYSQLFOLDERPRESENT" = 1 ]; then
15+
echo -e "$MYSQLFOLDERLOCATION" ${RED}does not exist, please choose another folder.${NC}
16+
SQLSetup
17+
fi
18+
}
19+
20+
SQLSetup
21+
22+
if [ ! "$(docker ps -q -f name=mysql80)" ]; then
23+
if [ "$(docker ps -aq -f status=exited -f name=mysql80)" ]; then
24+
# cleanup
25+
docker rm mysql80
26+
fi
27+
# run your container
28+
docker run -d -p 3306:3306 -p 33060:33060 --volume "$MYSQLFOLDERLOCATION":/var/lib/mysql --name mysql80 frostedflakez/php-mysql-webserver:0.9-beta.3-mysql-latest-8.0
29+
fi
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
NC='\033[0m' # No Color
4+
YELLOW='\033[1;33m'
5+
RED='\033[1;31m'
6+
7+
function SQLSetup() {
8+
read -p 'Where would you like your MySQL server files to reside on your local machine (absolute path, must exist)? ' MYSQLFOLDERLOCATION
9+
ls "$MYSQLFOLDERLOCATION"
10+
ISMYSQLFOLDERPRESENT=$?
11+
if [ -z "$MYSQLFOLDERLOCATION" ]; then
12+
echo -e "${YELLOW}The path of the MySQL file folder cannot be empty. Please choose a folder.${NC}"
13+
SQLSetup
14+
elif [ "$ISMYSQLFOLDERPRESENT" = 1 ]; then
15+
echo -e "$MYSQLFOLDERLOCATION" ${RED}does not exist, please choose another folder.${NC}
16+
SQLSetup
17+
fi
18+
}
19+
20+
SQLSetup
21+
22+
if [ ! "$(docker ps -q -f name=mysql80)" ]; then
23+
if [ "$(docker ps -aq -f status=exited -f name=mysql80)" ]; then
24+
# cleanup
25+
docker rm mysql80
26+
fi
27+
# run your container
28+
docker run -d -p 3306:3306 -p 33060:33060 --volume "$MYSQLFOLDERLOCATION":/var/lib/mysql --name mysql80 frostedflakez/php-mysql-webserver:0.9-beta.3-mysql-latest-8.0
29+
fi
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
NC='\033[0m' # No Color
4+
YELLOW='\033[1;33m'
5+
RED='\033[1;31m'
6+
7+
function SQLSetup() {
8+
read -p 'Where would you like your MySQL server files to reside on your local machine (absolute path, must exist)? ' MYSQLFOLDERLOCATION
9+
ls "$MYSQLFOLDERLOCATION"
10+
ISMYSQLFOLDERPRESENT=$?
11+
if [ -z "$MYSQLFOLDERLOCATION" ]; then
12+
echo -e "${YELLOW}The path of the MySQL file folder cannot be empty. Please choose a folder.${NC}"
13+
SQLSetup
14+
elif [ "$ISMYSQLFOLDERPRESENT" = 1 ]; then
15+
echo -e "$MYSQLFOLDERLOCATION" ${RED}does not exist, please choose another folder.${NC}
16+
SQLSetup
17+
fi
18+
}
19+
20+
SQLSetup
21+
22+
if [ ! "$(docker ps -q -f name=mysql80)" ]; then
23+
if [ "$(docker ps -aq -f status=exited -f name=mysql80)" ]; then
24+
# cleanup
25+
docker rm mysql80
26+
fi
27+
# run your container
28+
docker run -d -p 3306:3306 -p 33060:33060 --volume "$MYSQLFOLDERLOCATION":/var/lib/mysql --name mysql80 frostedflakez/php-mysql-webserver:0.9-beta.3-mysql-latest-8.0
29+
fi

0 commit comments

Comments
 (0)