Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tutor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas MENARD
Tutor
Commits
55860971
Commit
55860971
authored
5 years ago
by
Thomas MENARD
Browse files
Options
Downloads
Patches
Plain Diff
Update tutor/templates/hooks/mysql/init
parent
ef6710ac
No related branches found
No related tags found
No related merge requests found
Pipeline
#31210
failed
5 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tutor/templates/hooks/mysql/init
+1
-18
1 addition, 18 deletions
tutor/templates/hooks/mysql/init
with
1 addition
and
18 deletions
tutor/templates/hooks/mysql/init
+
1
−
18
View file @
55860971
echo "Initialising MySQL..."
echo "Nothing to do on MySQL..."
mysql_connection_max_attempts=10
mysql_connection_attempt=0
until mysql -u root --password="{{ MYSQL_ROOT_PASSWORD }}" --host "{{ MYSQL_HOST }}" --port {{ MYSQL_PORT }} -e 'exit'
do
mysql_connection_attempt=$(expr $mysql_connection_attempt + 1)
echo " [$mysql_connection_attempt/$mysql_connection_max_attempts] Waiting for MySQL service (this may take a while)..."
if [ $mysql_connection_attempt -eq $mysql_connection_max_attempts ]
then
echo "MySQL initialisation error" 1>&2
exit 1
fi
sleep 10
done
echo "MySQL is up and running"
mysql -u root --password="{{ MYSQL_ROOT_PASSWORD }}" --host "{{ MYSQL_HOST }}" --port {{ MYSQL_PORT }} -e 'CREATE DATABASE IF NOT EXISTS {{ OPENEDX_MYSQL_DATABASE }};'
mysql -u root --password="{{ MYSQL_ROOT_PASSWORD }}" --host "{{ MYSQL_HOST }}" --port {{ MYSQL_PORT }} -e 'GRANT ALL ON {{ OPENEDX_MYSQL_DATABASE }}.* TO "{{ OPENEDX_MYSQL_USERNAME }}"@"%" IDENTIFIED BY "{{ OPENEDX_MYSQL_PASSWORD }}";'
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Thomas MENARD
@tmenard
mentioned in commit
8d6d5abc
·
5 years ago
mentioned in commit
8d6d5abc
mentioned in commit 8d6d5abc6ea5619807a0bbbcd9aa813ab1265f5f
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment