Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab FOSS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab FOSS
Commits
b0a82995
Commit
b0a82995
authored
5 years ago
by
Evan Read
Committed by
Achilleas Pipinellis
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Edit MySQL services page
parent
7e14fc25
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/ci/services/mysql.md
+11
-14
11 additions, 14 deletions
doc/ci/services/mysql.md
with
11 additions
and
14 deletions
doc/ci/services/mysql.md
+
11
−
14
View file @
b0a82995
...
...
@@ -18,7 +18,7 @@ services:
variables
:
# Configure mysql environment variables (https://hub.docker.com/_/mysql/)
MYSQL_DATABASE
:
"
<your_mysql_database>"
MYSQL_ROOT_PASSWORD
:
"
mysql_strong
_password"
MYSQL_ROOT_PASSWORD
:
"
<your_mysql
_password
>
"
```
And then configure your application to use the database, for example:
...
...
@@ -26,18 +26,18 @@ And then configure your application to use the database, for example:
```
yaml
Host
:
mysql
User
:
root
Password
:
mysql_strong
_password
Database
:
el_duderino
Password
:
<your_mysql
_password
>
Database
:
<your_mysql_database>
```
If you are wondering why we used
`mysql`
for the
`Host`
, read more at
[
How services are linked to the job
](
../docker/using_docker_images.md#how-services-are-linked-to-the-job
)
.
You can also use any other docker image available on
[
Docker Hub
]
[
hub-
mysql
]
.
You can also use any other docker image available on
[
Docker Hub
]
(
https://hub.docker.com/_/
mysql
/
)
.
For example, to use MySQL 5.5 the service becomes
`mysql:5.5`
.
The
`mysql`
image can accept some environment variables. For more details
check the documentation on
[
Docker Hub
]
[
hub-
mysql
]
.
check the documentation on
[
Docker Hub
]
(
https://hub.docker.com/_/
mysql
/
)
.
## Use MySQL with the Shell executor
...
...
@@ -74,13 +74,13 @@ mysql> CREATE USER 'runner'@'localhost' IDENTIFIED BY '$password';
Create the database:
```
bash
mysql> CREATE DATABASE IF NOT EXISTS
`
el_duderino
`
DEFAULT CHARACTER SET
`
utf8
`
COLLATE
`
utf8_unicode_ci
`
;
mysql> CREATE DATABASE IF NOT EXISTS
`
<your_mysql_database>
`
DEFAULT CHARACTER SET
`
utf8
`
COLLATE
`
utf8_unicode_ci
`
;
```
Grant the necessary permissions on the database:
```
bash
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, CREATE TEMPORARY TABLES, DROP, INDEX, ALTER, LOCK TABLES ON
`
el_duderino
`
.
*
TO
'runner'
@
'localhost'
;
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, CREATE TEMPORARY TABLES, DROP, INDEX, ALTER, LOCK TABLES ON
`
<your_mysql_database>
`
.
*
TO
'runner'
@
'localhost'
;
```
If all went well you can now quit the database session:
...
...
@@ -93,7 +93,7 @@ Now, try to connect to the newly created database to check that everything is
in place:
```
bash
mysql
-u
runner
-p
-D
el_duderino
mysql
-u
runner
-p
-D
<your_mysql_database>
```
As a final step, configure your application to use the database, for example:
...
...
@@ -102,17 +102,14 @@ As a final step, configure your application to use the database, for example:
Host: localhost
User: runner
Password:
$password
Database:
el_duderino
Database:
<your_mysql_database>
```
## Example project
We have set up an
[
Example MySQL Project
]
[
mysql-example-repo
]
for your
We have set up an
[
Example MySQL Project
]
(
https://gitlab.com/gitlab-examples/mysql
)
for your
convenience that runs on
[
GitLab.com
](
https://gitlab.com
)
using our publicly
available
[
shared runners
](
../runners/README.md
)
.
Want to hack on it? Simply fork it, commit and push
your changes. Within a few
Want to hack on it? Simply fork it, commit and push your changes. Within a few
moments the changes will be picked by a public runner and the job will begin.
[
hub-mysql
]:
https://hub.docker.com/_/mysql/
[
mysql-example-repo
]:
https://gitlab.com/gitlab-examples/mysql
This diff is collapsed.
Click to expand it.
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