Bug 1194611

Summary: the 'test' database is no longer provided by default
Product: Red Hat Software Collections Reporter: Karel Volný <kvolny>
Component: mysqlAssignee: Honza Horak <hhorak>
Status: CLOSED ERRATA QA Contact: Karel Volný <kvolny>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rh-mysql56CC: databases-maint, hhorak
Target Milestone: rc   
Target Release: 2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rh-mysql56-mysql-5.6.23-6.el6, rh-mysql56-mysql-5.6.23-6.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1200147 (view as bug list) Environment:
Last Closed: 2015-06-04 08:44:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1200147    

Description Karel Volný 2015-02-20 11:13:41 UTC
Description of problem:
mysql-server used to provide a database named 'test' by default, which could have been used for mysql client that required a database name to be specified but didn't manipulate any data
in rh-mysql56, the 'test' database is no longer created by default, breaking everything that relied on its existence

Version-Release number of selected component (if applicable):
rh-mysql56-mysql-5.6.23-2.el6
rh-mysql56-mysql-5.6.23-2.el7

How reproducible:
always

Steps to Reproduce:
1. have a clean system, install rh-mysql56
2. scl enable rh-mysql56 bash
3. service rh-mysql56-mysqld start
4. mysql -e "SELECT 1+1;" test

Actual results:
ERROR 1049 (42000): Unknown database 'test'

Expected results:
+-----+
| 1+1 |
+-----+
|   2 |
+-----+


Additional info:
on RHEL6, the startup messages say:

...
Alternatively you can run:

  /opt/rh/rh-mysql56/root/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
...

which suggests that 'test' should be present (otherwise there would be nothing to remove)

Comment 2 Honza Horak 2015-02-20 14:59:10 UTC
I've found no documentation so far why the test database was removed, if that was some security reason or whatever else or just mistake. Anyway, I don't plan to add `test` db creation downstream, so I'd rather fix the tests to ensure the database is created.

Comment 4 Karel Volný 2015-02-20 17:13:01 UTC
(In reply to Honza Horak from comment #2)
> so I'd rather fix the tests to ensure the database is created.

so far, I've found twenty tests affected and counting ...

which is the smaller problem, I can hack the library to create the database after starting mysql

what is worse is that our tests are probably not the only place where 'test' is used as a database name which is always present - I've seen it in some bug reproducers from customers too

but we can leave it missing and see who will complain :-)

in that case, I guess this is something that would deserve to be well documented ...

Comment 5 Karel Volný 2015-02-24 14:32:44 UTC
(In reply to Karel Volný from comment #4)
> what is worse is that our tests are probably not the only place where 'test'
> is used as a database name which is always present

and not just our tests - even mysql's own tests from rh-mysql56-mysql-bench fail due to this:

:: [  BEGIN   ] :: Running 'pushd /opt/rh/rh-mysql56/root/usr/share/sql-bench'
/opt/rh/rh-mysql56/root/usr/share/sql-bench /tmp/tmp.g9UvOdAxzO /mnt/tests/CoreOS/mysql/Sanity/benchmark
:: [   PASS   ] :: Command 'pushd /opt/rh/rh-mysql56/root/usr/share/sql-bench' (Expected 0, got 0)
:: [  BEGIN   ] :: Running './run-all-tests --server=mysql --log'
Got error: 'Unknown database 'test'' when connecting to DBI:mysql:database=test;host=localhost with user: '' password: ''
:: [   FAIL   ] :: Command './run-all-tests --server=mysql --log' (Expected 0, got 255)

Comment 6 Honza Horak 2015-03-09 20:30:51 UTC
So, I've checked this change with upstream and the `test` db is removed in upstream (since 5.7) from default installation, being it considered a security issue. Thus, the tests should create the `test` database if they use it.

Comment 7 Karel Volný 2015-03-11 13:23:25 UTC
(In reply to Honza Horak from comment #6)
> So, I've checked this change with upstream and the `test` db is removed in
> upstream (since 5.7) from default installation, being it considered a
> security issue.

ok, so let's document it

> Thus, the tests should create the `test` database if they use it.

I hope you mean also when used by software from mysql packages (comment #5) which you are going to fix as well as the message or maybe the whole mysql_secure_installation thingy mentioned in the bug description :-)

Comment 14 errata-xmlrpc 2015-06-04 08:44:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHEA-2015-1059.html