The issues is that in case of using empty password (e.g. --mysql-password="") the password is being overridden by the environment variable MYSQL_PWD
How to repeat problem:
mysql#
drop database if exists sbtest; create database sbtest;
drop user if exists sbtest@localhost;
create user sbtest@localhost IDENTIFIED BY '';
grant all on sbtest.* to sbtest@localhost;
bash#
export MYSQL_PWD="123" ; sysbench /usr/share/sysbench/oltp_read_write.lua prepare \
--mysql-host=localhost --mysql-socket=/srv/lab/run/mysqld_lab.sock --mysql-user=sbtest \
--mysql-password=""
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
FATAL: unable to connect to MySQL server on socket '/srv/lab/run/mysqld_lab.sock', aborting...
FATAL: error 1045: Access denied for user 'sbtest'@'localhost' (using password: YES)
FATAL: `sysbench.cmdline.call_command' function failed: /usr/share/sysbench/oltp_common.lua:83: connection creation failed
If the --mysql-password='nonempty' then it is honored properly. Example:
mysql#
drop database if exists sbtest; create database sbtest;
drop user if exists sbtest@localhost;
create user sbtest@localhost IDENTIFIED BY 'something';
grant all on sbtest.* to sbtest@localhost;
bash#
export MYSQL_PWD="123" ; sysbench /usr/share/sysbench/oltp_read_write.lua prepare \
--mysql-host=localhost --mysql-socket=/srv/lab/run/mysqld_lab.sock --mysql-user=sbtest \
--mysql-password="something"
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
Creating table 'sbtest1'...
Inserting 10000 records into 'sbtest1'
Creating a secondary index on 'sbtest1'...
The issues is that in case of using empty password (e.g. --mysql-password="") the password is being overridden by the environment variable MYSQL_PWD
How to repeat problem:
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
FATAL: unable to connect to MySQL server on socket '/srv/lab/run/mysqld_lab.sock', aborting...
FATAL: error 1045: Access denied for user 'sbtest'@'localhost' (using password: YES)
FATAL: `sysbench.cmdline.call_command' function failed: /usr/share/sysbench/oltp_common.lua:83: connection creation failed
If the --mysql-password='nonempty' then it is honored properly. Example:
sysbench 1.0.20 (using bundled LuaJIT 2.1.0-beta2)
Creating table 'sbtest1'...
Inserting 10000 records into 'sbtest1'
Creating a secondary index on 'sbtest1'...