Skip to content

Commit 44c651b

Browse files
committed
Revert "Change db_initialized function to check against database instead of files"
This reverts commit f77f744.
1 parent f77f744 commit 44c651b

File tree

2 files changed

+6
-24
lines changed

2 files changed

+6
-24
lines changed

CHANGELOG.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ All notable changes to this project will be documented in this file.
44

55
## Unreleased
66

7-
Fix #715: Update `db_initialized?` to be based on database connection instead of file existence
8-
97
## 11.1.9 - *2024-12-09*
108

119
## 11.1.8 - *2024-11-18*
@@ -663,7 +661,7 @@ Adding Ubuntu 13.04 to Platforminfo
663661
- **[COOK-2966] - Address foodcritic failures'
664662
- **[COOK-4182] - Template parse failure in /etc/init/mysql.conf (data_dir)'
665663
- **[COOK-4198] - Added missing tunable'
666-
- **[COOK-4206] - create `[email protected]`, as well as `root@localhost`'
664+
- **[COOK-4206] - create [email protected], as well as root@localhost'
667665

668666
## [4.0.20] - 2014-01-18
669667

libraries/helpers.rb

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -257,21 +257,11 @@ def db_init
257257
end
258258

259259
def db_initialized?
260-
cmd = shell_out("test \"#{db_initialized_check_cmd}\" -gt 0", user: 'root')
261-
cmd.exitstatus == 0
262-
end
263-
264-
def db_initialized_check_cmd
265-
# If MySQL is running, mysqladmin ping will return 0 even with invalid credentials
266-
# if MySQL is not running, mysqladmin will return 1 even with valid credentials
267-
cmd = mysqladmin_bin
268-
cmd << ' --user=UNKNOWN_MYSQL_USER'
269-
cmd << ' ping > /dev/null 2>&1 &&'
270-
cmd << " #{mysql_client_bin} #{defaults_file}"
271-
cmd << ' --skip-column-names --batch'
272-
cmd << " --execute=\"SELECT count(*) FROM mysql.db WHERE db LIKE 'test%'\""
273-
return "scl enable #{scl_name} \"#{cmd}\"" if scl_package?
274-
cmd
260+
if v80plus
261+
::File.exist? "#{data_dir}/mysql.ibd"
262+
else
263+
::File.exist? "#{data_dir}/mysql/user.frm"
264+
end
275265
end
276266

277267
def mysql_install_db_bin
@@ -289,12 +279,6 @@ def mysql_install_db_cmd
289279
cmd
290280
end
291281

292-
def mysql_client_bin
293-
return "#{prefix_dir}/bin/mysql" if platform_family?('smartos')
294-
return 'mysql' if scl_package?
295-
"#{prefix_dir}/usr/bin/mysql"
296-
end
297-
298282
def mysqladmin_bin
299283
return "#{prefix_dir}/bin/mysqladmin" if platform_family?('smartos')
300284
return 'mysqladmin' if scl_package?

0 commit comments

Comments
 (0)