actions-setup-mysql
ActionsTags
(1)This action sets up a MySQL database for use in actions by:
- download a version of MySQL or MariaDB
- start mysqld
- GitHub-Hosted Runners have MySQL Server, but only Linux.
- GitHub Actions supports Docker services, and there is the official MySQL image. But it works on only Linux.
- Some utils for MySQL (such as MySQL::Partition, App::Prove::Plugin::MySQLPool, Test::mysqld) requires MySQL installed on the local host.
steps:
- uses: actions/checkout@v4
- uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "8.0"
- run: mysql -uroot -e 'SELECT version()'The version of MySQL or MariaDB.
Available Versions are:
- MySQL
9.08.48.38.28.18.05.75.6
- MariaDB
11.711.611.511.411.311.211.111.010.1110.1010.910.810.710.610.510.410.310.2
The distribution. The valid values are mysql or mariadb.
The default value is mysql.
You can use mysql- and mariadb- prefixes in mysql-version instead of the distribution input.
For example, the following two workflows install MariaDB 10.6.
- uses: shogo82148/actions-setup-mysql@v1
with:
distribution: "mariadb"
mysql-version: "10.6"- uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "mariadb-10.6"If it is true, the action starts the MySQL server.
If it is false, the action doesn't start the MySQL sever.
You need to execute the mysqld command yourself.
The default value is true.
my.cnf settings for mysqld.
It uses the same syntax as my.cnf.
Example:
- uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "8.0"
my-cnf: |
innodb_log_file_size=256MB
innodb_buffer_pool_size=512MB
max_allowed_packet=16MB
max_connections=50
local_infile=1The password for the root user.
The name of the new user.
The password for the new user.
The directory under which the mysql database is being created.
It contains:
etc/my.cnftmp/mysqld.logtmp/mysqld.pidtmp/mysql.sockvar: The default path ofdatadirvar/ca.pem: The root certificate of the certification authority for SSL/TLSvar/server-cert.pem: The server certificate for SSL/TLSvar/server-key.pem: The server key for SSL/TLS
Here are some examples:
- id: setup-mysql
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "8.0"
- name: connect via unix domain socket
run: mysql -uroot \
--protocol=SOCKET \
--socket=${{ steps.setup-mysql.outputs.base-dir }}/tmp/mysql.sock
-e 'SELECT version()'
- name: configure the root certificate for connecting via SSL/TLS.
run: mysql -uroot \
--ssl --ssl-mode=REQUIRED \
--ssl-ca=${{ steps.setup-mysql.outputs.base-dir }}/var/ca.pem \
-e 'SELECT version()'The path to the directory in which the server-specific my.cnf file resides.
Directory in which to look for client plugins.
actions-setup-mysql is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.