count distinct column without null value in MySQL 5.7
MySQL works like you expected and it should return 1.
create table t (a int, b int);
insert into t (a, b) values (1, null), (2, 1);
select * from t;
select count(distinct b) from t;

dbfiddle: https://dbfiddle.uk/?rdbms=mysql_5.7&amp;fiddle=4fd6a3744a042c376880f030f4d12101