[debian-mysql] Bug#848616: mysql_install_db creates unusable root user

Christian Hofstaedtler zeha at debian.org
Mon Dec 19 00:25:20 UTC 2016


Package: mariadb-server-10.0
Version: 10.0.28-2
Severity: serious

mysql_install_db fails to create a working root user when run as
non-root or maybe with a custom datadir.
This is serious because various packages use this to set up a
temporary mysqld to test themselves.

Repro steps:

ch at d:~ % mktemp -d
/tmp/tmp.WiS7YFCukw
ch at d:~ % mysql_install_db --no-defaults --datadir=/tmp/tmp.WiS7YFCukw --force --skip-name-resolve            
Installing MariaDB/MySQL system tables in '/tmp/tmp.WiS7YFCukw' ...
161219  0:18:34 [Note] /usr/sbin/mysqld (mysqld 10.0.28-MariaDB-2) starting as process 11914 ...
161219  0:18:34 [Note] InnoDB: Using mutexes to ref count buffer pool pages
161219  0:18:34 [Note] InnoDB: The InnoDB memory heap is disabled
161219  0:18:34 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
161219  0:18:34 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
161219  0:18:34 [Note] InnoDB: Compressed tables use zlib 1.2.8
161219  0:18:34 [Note] InnoDB: Using Linux native AIO
161219  0:18:34 [Note] InnoDB: Using CPU crc32 instructions
161219  0:18:34 [Note] InnoDB: Initializing buffer pool, size = 128.0M
161219  0:18:34 [Note] InnoDB: Completed initialization of buffer pool
161219  0:18:34 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
161219  0:18:34 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
161219  0:18:34 [Note] InnoDB: Database physically writes the file full: wait...
161219  0:18:34 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
161219  0:18:34 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
161219  0:18:34 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
161219  0:18:34 [Warning] InnoDB: New log files created, LSN=45781
161219  0:18:34 [Note] InnoDB: Doublewrite buffer not found: creating new
161219  0:18:34 [Note] InnoDB: Doublewrite buffer created
161219  0:18:34 [Note] InnoDB: 128 rollback segment(s) are active.
161219  0:18:34 [Warning] InnoDB: Creating foreign key constraint system tables.
161219  0:18:34 [Note] InnoDB: Foreign key constraint system tables created
161219  0:18:34 [Note] InnoDB: Creating tablespace and datafile system tables.
161219  0:18:34 [Note] InnoDB: Tablespace and datafile system tables created.
161219  0:18:34 [Note] InnoDB: Creating zip_dict and zip_dict_cols system tables.
161219  0:18:34 [Note] InnoDB: zip_dict and zip_dict_cols system tables created.
161219  0:18:34 [Note] InnoDB: Waiting for purge to start
161219  0:18:34 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.32-79.0 started; log sequence number 0
161219  0:18:34 [Note] InnoDB: FTS optimize thread exiting.
161219  0:18:34 [Note] InnoDB: Starting shutdown...
161219  0:18:35 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
161219  0:18:37 [Note] InnoDB: Shutdown completed; log sequence number 1623569
OK
Filling help tables...
161219  0:18:37 [Note] /usr/sbin/mysqld (mysqld 10.0.28-MariaDB-2) starting as process 11940 ...
161219  0:18:37 [Note] InnoDB: Using mutexes to ref count buffer pool pages
161219  0:18:37 [Note] InnoDB: The InnoDB memory heap is disabled
161219  0:18:37 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
161219  0:18:37 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
161219  0:18:37 [Note] InnoDB: Compressed tables use zlib 1.2.8
161219  0:18:37 [Note] InnoDB: Using Linux native AIO
161219  0:18:37 [Note] InnoDB: Using CPU crc32 instructions
161219  0:18:37 [Note] InnoDB: Initializing buffer pool, size = 128.0M
161219  0:18:37 [Note] InnoDB: Completed initialization of buffer pool
161219  0:18:37 [Note] InnoDB: Highest supported file format is Barracuda.
161219  0:18:37 [Note] InnoDB: 128 rollback segment(s) are active.
161219  0:18:37 [Note] InnoDB: Waiting for purge to start
161219  0:18:37 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.32-79.0 started; log sequence number 1623569
161219  0:18:37 [Note] InnoDB: FTS optimize thread exiting.
161219  0:18:37 [Note] InnoDB: Starting shutdown...
161219  0:18:38 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
161219  0:18:40 [Note] InnoDB: Shutdown completed; log sequence number 1623579
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h  password 'new-password'

Alternatively you can run:
'/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.

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '/usr' ; /usr/bin/mysqld_safe --datadir='/tmp/tmp.WiS7YFCukw'

You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/mysql-test' ; perl mysql-test-run.pl

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Support MariaDB development by buying support/new features from MariaDB
Corporation Ab. You can contact us about this at sales at mariadb.com.
Alternatively consider joining our community based development effort:
http://mariadb.com/kb/en/contributing-to-the-mariadb-project/

ch at d:~ % /usr/sbin/mysqld --no-defaults --socket=/tmp/tmp.WiS7YFCukw/mysql.sock --datadir=/tmp/tmp.WiS7YFCukw --skip-networking
161219  0:19:09 [Note] /usr/sbin/mysqld (mysqld 10.0.28-MariaDB-2) starting as process 11972 ...
161219  0:19:09 [Note] InnoDB: Using mutexes to ref count buffer pool pages
161219  0:19:09 [Note] InnoDB: The InnoDB memory heap is disabled
161219  0:19:09 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
161219  0:19:09 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
161219  0:19:09 [Note] InnoDB: Compressed tables use zlib 1.2.8
161219  0:19:09 [Note] InnoDB: Using Linux native AIO
161219  0:19:09 [Note] InnoDB: Using CPU crc32 instructions
161219  0:19:09 [Note] InnoDB: Initializing buffer pool, size = 128.0M
161219  0:19:09 [Note] InnoDB: Completed initialization of buffer pool
161219  0:19:09 [Note] InnoDB: Highest supported file format is Barracuda.
161219  0:19:10 [Note] InnoDB: 128 rollback segment(s) are active.
161219  0:19:10 [Note] InnoDB: Waiting for purge to start
161219  0:19:10 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.32-79.0 started; log sequence number 1623579
161219  0:19:10 [Note] Plugin 'FEEDBACK' is disabled.
161219  0:19:10 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.0.28-MariaDB-2'  socket: '/tmp/tmp.WiS7YFCukw/mysql.sock'  port: 0  Debian unstable

[in another shell:]

ch at d:~ % /usr/bin/mysqladmin --socket=/tmp/tmp.WiS7YFCukw/mysql.sock ping
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'ch'@'localhost''
ch at d:~ % /usr/bin/mysqladmin --socket=/tmp/tmp.WiS7YFCukw/mysql.sock ping -u root
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost''

-- 
christian hofstaedtler <zeha at debian.org>



More information about the pkg-mysql-maint mailing list