Skip to content

Commit 4db5952

Browse files
committed
Refresh MySQL 8.x config
1 parent 7efa6dc commit 4db5952

File tree

13 files changed

+174
-111
lines changed

13 files changed

+174
-111
lines changed

.github/workflows/pr-drupal-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
- examples/drupal10-mysql8
3030
- examples/drupal10-nginx
3131
- examples/drupal11
32+
- examples/drupal11-mysql84
3233
- examples/drupal11-nginx
3334
lando-version:
3435
- 3-edge

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})
22

3+
* Updated MySQL config for better MySQL 8.4 support.
34
* Added default config values to the `.lando.yml` file after init.
45
* Removed `semver` dependency from the plugin.
56

builders/_drupaly.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const getServices = options => ({
146146
},
147147
database: {
148148
config: getServiceConfig(options, ['database']),
149-
authentication: 'mysql_native_password',
149+
authentication: '',
150150
type: `drupal-${options.database}`,
151151
portforward: true,
152152
creds: {
@@ -165,20 +165,20 @@ const getDbTooling = (database, options) => {
165165
const [db, ver] = database.split(':');
166166
// Choose wisely
167167
if (db === 'mysql') {
168-
return { mysql: mysqlCli };
168+
return {mysql: mysqlCli};
169169
} else if (db === 'mariadb' && semver.lt(semver.coerce(ver), '10.4.0')) {
170170
// Use mysql command for MariaDB 10.3.x and below
171-
return { mysql: mysqlCli };
171+
return {mysql: mysqlCli};
172172
} else if (db === 'mariadb') {
173-
return { mariadb: mariadbCli };
173+
return {mariadb: mariadbCli};
174174
} else if (db === 'postgres') {
175-
return { psql: postgresCli };
175+
return {psql: postgresCli};
176176
} else if (db === 'mongo') {
177177
return {
178178
mongo: {
179179
service: 'database',
180180
description: 'Drop into the mongo shell',
181-
}
181+
},
182182
};
183183
}
184184
};
@@ -192,7 +192,7 @@ const getProxy = (options, proxyService = 'appserver') => {
192192
// add
193193
urls.push(`${options.app}.${options._app._config.domain}`);
194194
// return
195-
return { [proxyService]: _.uniq(_.compact(urls)) };
195+
return {[proxyService]: _.uniq(_.compact(urls))};
196196
};
197197

198198
/*
@@ -236,7 +236,7 @@ module.exports = {
236236
tooling: {
237237
drush: {
238238
service: 'appserver',
239-
}
239+
},
240240
},
241241
via: 'apache:2.4',
242242
webroot: '.',
@@ -275,8 +275,8 @@ module.exports = {
275275
SIMPLETEST_BASE_URL: (options.via === 'nginx') ? 'https://appserver_nginx' : 'https://appserver',
276276
SIMPLETEST_DB: `mysql://${options.recipe}:${options.recipe}@database/${options.recipe}`,
277277
},
278-
}
279-
}
278+
},
279+
},
280280
});
281281

282282
// Switch the proxy service if needed

builders/drupal-mariadb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const _ = require('lodash');
4-
const LandoMariadb = require('./../node_modules/@lando/mariadb/builders/mariadb.js');
4+
const LandoMariadb = require('@lando/mariadb/builders/mariadb.js');
55

66
// Builder
77
module.exports = {

builders/drupal-mssql.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const _ = require('lodash');
4-
const LandoMssql = require('./../node_modules/@lando/mssql/builders/mssql.js');
4+
const LandoMssql = require('@lando/mssql/builders/mssql.js');
55

66
// Builder
77
module.exports = {

builders/drupal-mysql.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
'use strict';
22

33
const _ = require('lodash');
4-
const LandoMysql = require('./../node_modules/@lando/mysql/builders/mysql.js');
4+
const LandoMysql = require('@lando/mysql/builders/mysql.js');
55

66
// Builder
77
module.exports = {
88
name: 'drupal-mysql',
99
parent: '_service',
1010
builder: parent => class DrupalMysql extends LandoMysql.builder(parent, LandoMysql.config) {
1111
constructor(id, options = {}) {
12+
const semver = options._app._lando.utils.getSemver();
13+
14+
// Versions of MySQL prior to 8.0 use mysql_native_password authentication
15+
if (!options.authentication && semver.lt(semver.coerce(options.version), '8.0.0')) {
16+
options.authentication = 'mysql_native_password';
17+
}
18+
1219
super(id, options, {services: _.set({}, options.name)});
1320
}
1421
},

builders/drupal-php.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
'use strict';
22

3-
const path = require('path');
4-
const landoPhpPath = path.join(__dirname, '../node_modules/@lando/php');
5-
const LandoPhp = require(`${landoPhpPath}/builders/php.js`);
3+
const LandoPhp = require('@lando/php/builders/php.js');
64

75
/**
86
* Drupal PHP builder class that extends Lando PHP builder.

builders/drupal-postgres.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const _ = require('lodash');
4-
const LandoPostgres = require('./../node_modules/@lando/postgres/builders/postgres.js');
4+
const LandoPostgres = require('@lando/postgres/builders/postgres.js');
55

66
// Builder
77
module.exports = {

config/drupal11/mysql8.cnf

Lines changed: 43 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -3,104 +3,55 @@
33
#
44
# LANDODRUPALMYSQL8CNF
55

6-
[mysqld]
7-
#
8-
# * Basic Settings
9-
#
10-
# Data is stored in a volume on the db container /sql
11-
default-storage-engine = innodb
6+
[server]
7+
# Basic settings
8+
mysql_native_password=ON
129

13-
#
14-
# * Fine Tuning
15-
#
16-
key_buffer_size = 384M
17-
max_allowed_packet = 32M
18-
thread_stack = 400K
19-
thread_cache_size = 8
20-
# This replaces the startup script and checks MyISAM tables if needed
21-
# the first time they are touched
22-
#max_connections = 100
23-
#table_cache = 64
24-
#thread_concurrency = 10
25-
read_rnd_buffer_size = 8M
26-
myisam_sort_buffer_size = 64M
27-
table_open_cache = 512
28-
sort_buffer_size = 2M
10+
# Character sets and SQL mode
11+
character_set_server = utf8mb4
12+
collation_server = utf8mb4_general_ci
13+
sql_mode = ONLY_FULL_GROUP_BY,TRADITIONAL
14+
15+
# Basic Tuning.
16+
max_connections = 500
17+
connect_timeout = 5
18+
wait_timeout = 28800
19+
max_allowed_packet = 32M
20+
thread_cache_size = 128
21+
sort_buffer_size = 4M
22+
bulk_insert_buffer_size = 16M
23+
tmp_table_size = 32M
24+
max_heap_table_size = 32M
25+
26+
# MyISAM.
27+
myisam_recover_options = BACKUP
28+
key_buffer_size = 128M
29+
table_open_cache = 400
30+
myisam_sort_buffer_size = 512M
31+
concurrent_insert = 2
2932
read_buffer_size = 2M
33+
read_rnd_buffer_size = 1M
3034

31-
#
32-
# * Logging and Replication
33-
#
34-
# Both location gets rotated by the cronjob.
35-
# Be aware that this log type is a performance killer.
36-
# As of 5.1 you can enable the log at runtime!
37-
#general_log_file = /src/.lando/log/mysql.log
38-
#general_log = 1
39-
#
40-
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
41-
#
42-
# Here you can see queries with especially long duration
43-
#log_slow_queries = /var/log/mysql/mysql-slow.log
44-
#long_query_time = 2
45-
#log-queries-not-using-indexes
46-
#
47-
# The following can be used as easy to replay backup logs or for replication.
48-
# note: if you are setting up a replication slave, see README.Debian about
49-
# other settings you may need to change.
50-
#server-id = 1
51-
#log_bin = /src/.lando/log/mysql-bin.log
52-
expire_logs_days = 10
53-
max_binlog_size = 101M
54-
#binlog_do_db = include_database_name
55-
#binlog_ignore_db = include_database_name
56-
#
57-
# * InnoDB
58-
#
59-
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
60-
# Read the manual for more InnoDB related options. There are many!
61-
#
62-
# Uncomment the following if you are using InnoDB tables
63-
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
64-
#innodb_log_group_home_dir = C:\mysql\data/
65-
# You can set .._buffer_pool_size up to 50 - 80 %
66-
# of RAM but beware of setting memory usage too high
67-
#innodb_buffer_pool_size = 384M
68-
#innodb_additional_mem_pool_size = 20M
69-
# Set .._log_file_size to 25 % of buffer pool size
70-
innodb_log_file_size = 100M
71-
#innodb_log_buffer_size = 8M
72-
innodb_flush_log_at_trx_commit = 0
73-
#innodb_lock_wait_timeout = 50
35+
# InnoDB.
36+
default_storage_engine = InnoDB
7437
innodb_buffer_pool_size = 384M
75-
innodb_log_buffer_size = 4M
76-
innodb_file_per_table = 1
77-
innodb_open_files = 256
78-
innodb_io_capacity = 512
79-
innodb_flush_method = O_DIRECT
80-
innodb_thread_concurrency = 8
38+
innodb_log_buffer_size = 8M
39+
innodb_file_per_table = 1
40+
innodb_open_files = 400
41+
innodb_io_capacity = 512
42+
innodb_thread_concurrency = 0
43+
innodb_read_io_threads = 16
44+
innodb_write_io_threads = 16
45+
innodb_flush_log_at_trx_commit = 0
46+
innodb_max_dirty_pages_pct = 70
47+
innodb_adaptive_hash_index = 0
48+
innodb_use_native_aio = 0
8149
innodb_lock_wait_timeout = 127
82-
#
83-
# * Security Features
84-
#
85-
# Read the manual, too, if you want chroot!
86-
# chroot = /var/lib/mysql/
87-
#
88-
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
89-
#
90-
# ssl-ca=/etc/mysql/cacert.pem
91-
# ssl-cert=/etc/mysql/server-cert.pem
92-
# ssl-key=/etc/mysql/server-key.pem
50+
51+
[client]
52+
default_character_set=utf8mb4
53+
max_allowed_packet = 64M
9354

9455
[mysqldump]
9556
quick
9657
quote-names
97-
max_allowed_packet = 32M
98-
99-
[mysql]
100-
#no-auto-rehash # faster start of mysql but no tab completion
101-
102-
[isamchk]
103-
key_buffer_size = 384M
104-
sort_buffer_size = 256M
105-
read_buffer = 2M
106-
write_buffer = 2M

examples/drupal-nginx/.lando.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ config:
55
webroot: web
66
php: 7.4
77

8-
98
tooling:
109
nginx:
1110
service: appserver_nginx

0 commit comments

Comments
 (0)