mysql slow query due to function in where

Query which take more than 13 secs to return output i did create the indexes but the execution plan doesnt seem to use them. Below are some information regarding

Query

SELECT  userinfo.username,userinfo.firstname,userinfo.lastname,userinfo.email,
radcheck.attribute,radcheck.value,radusergroup.groupname, userinfo.id,
userinfo.workphone,userinfo.homephone,
userinfo.mobilephone,userinfo.address, userinfo.zone,
userinfo.account_state,userinfo.device_owner,userinfo.link_type,userinfo.account_type 
FROM userinfo  
INNER JOIN radcheck ON userinfo.username = radcheck.username  
INNER JOIN radusergroup ON userinfo.username = radusergroup.username 
WHERE  radcheck.attribute='Expiration'  and 
STR_TO_DATE(radcheck.value, '%d %M %Y') < CURDATE() 
and radusergroup.groupname='Customer30M';

Explain output

+----+-------------+--------------+------+--------------------+-----------+---------+--------------------------------+------+-----------------------------------+
| id | select_type | table        | type | possible_keys      | key       | key_len | ref                            | rows | Extra                             |
+----+-------------+--------------+------+--------------------+-----------+---------+--------------------------------+------+-----------------------------------+
|  1 | SIMPLE      | radusergroup | ref  | username,groupname | groupname | 66      | const                          |    5 | Using where with pushed condition |
|  1 | SIMPLE      | radcheck     | ref  | username,attribute | attribute | 34      | const                          |    9 | Using where                       |
|  1 | SIMPLE      | userinfo     | ref  | username           | username  | 131     | ctradius.radusergroup.username |   10 | Using where                       |
+----+-------------+--------------+------+--------------------+-----------+---------+--------------------------------+------+-----------------------------------+
3 rows in set (0.00 sec)

Table Info

Table: radusergroup
+-----------+-------------+------+-----+---------+----------------+
| Field     | Type        | Null | Key | Default | Extra          |
+-----------+-------------+------+-----+---------+----------------+
| id        | int(11)     | NO   | PRI | NULL    | auto_increment |
| username  | varchar(64) | NO   | MUL |         |                |
| groupname | varchar(64) | NO   | MUL |         |                |
| priority  | int(11)     | NO   |     | 1       |                |
+-----------+-------------+------+-----+---------+----------------+
radusergroup table Index
+--------------+------------+-------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table        | Non_unique | Key_name          | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+--------------+------------+-------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| radusergroup |          0 | PRIMARY           |            1 | id          | A         |       11292 |     NULL | NULL   |      | BTREE      |         |               |
| radusergroup |          1 | username          |            1 | username    | A         |        NULL |     NULL | NULL   |      | BTREE      |         |               |
| radusergroup |          1 | groupname         |            1 | groupname   | A         |        NULL |     NULL | NULL   |      | BTREE      |         |               |
| radusergroup |          1 | indexradusergroup |            1 | username    | A         |        NULL |     NULL | NULL   |      | BTREE      |         |               |
| radusergroup |          1 | indexradusergroup |            2 | groupname   | A         |        NULL |     NULL | NULL   |      | BTREE      |         |               |
Table : userinfo
---------------------+------------------+------+-----+---------------------+----------------+
| Field               | Type             | Null | Key | Default             | Extra          |
+---------------------+------------------+------+-----+---------------------+----------------+
| id                  | int(11) unsigned | NO   | PRI | NULL                | auto_increment |
| username            | varchar(128)     | YES  | MUL | NULL                |                |
| firstname           | varchar(200)     | YES  |     | NULL                |                |
| lastname            | varchar(200)     | YES  |     | NULL                |                |
| email               | varchar(200)     | YES  |     | NULL                |                |
| workphone           | varchar(200)     | YES  |     | NULL                |                |
| homephone           | varchar(200)     | YES  |     | NULL                |                |
| mobilephone         | varchar(200)     | YES  |     | NULL                |                |
| address             | varchar(200)     | YES  |     | NULL                |                |
| zone                | varchar(20)      | YES  |     | NULL                |                |
| account_state       | varchar(10)      | YES  |     | active              |                |
| change_commit       | tinyint(1)       | YES  |     | NULL                |                |
| link_type           | varchar(8)       | YES  |     | NULL                |                |
| account_type        | varchar(255)     | YES  |     | NULL                |                |
| device_owner        | varchar(255)     | YES  |     | NULL                |                |
| account_name        | varchar(255)     | YES  |     | NULL                |                |
| account_email       | varchar(255)     | YES  |     | NULL                |                |
| account_mobile      | varchar(255)     | YES  |     | NULL                |                |
| groupname           | varchar(255)     | YES  |     | NULL                |                |
+---------------------+------------------+------+-----+---------------------+----------------+
Indexes on userinfo
----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table    | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| userinfo |          0 | PRIMARY  |            1 | id          | A         |       11282 |     NULL | NULL   |      | BTREE      |         |               |
| userinfo |          1 | username |            1 | username    | A         |        NULL |     NULL | NULL   | YES  | BTREE      |         |               |
+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
Table: Radcheck
+-----------+------------------+------+-----+---------+----------------+
| Field     | Type             | Null | Key | Default | Extra          |
+-----------+------------------+------+-----+---------+----------------+
| id        | int(11) unsigned | NO   | PRI | NULL    | auto_increment |
| username  | varchar(64)      | NO   | MUL |         |                |
| attribute | varchar(32)      | NO   | MUL |         |                |
| op        | char(2)          | NO   |     | ==      |                |
| value     | varchar(253)     | NO   | MUL |         |                |
+-----------+------------------+------+-----+---------+----------------+
indexes on radcheck
+----------+------------+---------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table    | Non_unique | Key_name      | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+----------+------------+---------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| radcheck |          0 | PRIMARY       |            1 | id          | A         |       33425 |     NULL | NULL   |      | BTREE      |         |               |
| radcheck |          1 | username      |            1 | username    | A         |        NULL |     NULL | NULL   |      | BTREE      |         |               |
| radcheck |          1 | value         |            1 | value       | A         |        NULL |     NULL | NULL   |      | BTREE      |         |               |
| radcheck |          1 | attribute     |            1 | attribute   | A         |        NULL |     NULL | NULL   |      | BTREE      |         |               |
Resolution:-
The function invalidates the use of the index. Despite cardinality showing 11k rows, the table scan ensues and it takes 13 seconds.
Though it  has a join between Radcheck and userinfo, it is the STR_TO_DATE function in the where clause that kills the index use.

pxe server configuration on centos 7 to bootup debian 8




In centos 7 (PXE  server)
Tested on virtualbox 5.1.24
Make sure below network card settings other wise fatal error:cannot read from boot medium is seen


Steps:1

mkdir /downloads
yum install epel-release rsync tcpdump wget curl vim httpd xinetd syslinux tftp-server -y
cd /usr/share/syslinux/
cp pxelinux.0 menu.c32 memdisk mboot.c32 chain.c32 /var/lib/tftpboot/
cp /etc/xinetd.d/tftp /downloads/
sed -i 's/yes/no/g' /etc/xinetd.d/tftp
mkdir -p /downloads/netboot
cd /downloads &&  wget http://ftp.debian.org/debian/dists/jessie/main/installer-amd64/current/images/netboot/netboot.tar.gz
mkdir -p /downloads/netboot
tar xvfz netboot.tar.gz -C /downloads/netboot/
rsync -avz /downloads/netboot/debian-installer /var/lib/tftpboot/
mkdir /var/lib/tftpboot/debian8

#cp -fr /mnt/debian8isomount /var/lib/tftpboot/debian8
cp -rf /mnt/* /var/lib/tftpboot/debian-installer/amd64/

#Then, create a configuration directory for PXE server:

mkdir /var/lib/tftpboot/pxelinux.cfg

#Now, create PXE server configuration file under the pxelinux.cfg:

vim /var/lib/tftpboot/pxelinux.cfg/default

default menu.c32
prompt 0
timeout 300
ONTIMEOUT local

label 1
menu label ^1) Install Debian 8 x64
kernel debian-installer/amd64/linux
append vga=788 initrd=debian-installer/amd64/initrd.gz -- quiet

label 2
menu label ^2) Install Debian 8 x64 Automated
kernel debian-installer/amd64/linux
append auto=true priority=critical vga=788 initrd=debian-installer/amd64/initrd.gz -- quiet

label 3
menu label ^3) Boot from local drive localboot

find default ip used for connection

ip route list

ip route get 8.8.8.8

# ip route get 8.8.8.8
8.8.8.8 via 100.126.1.1 dev eth0  src 100.126.1.100
    cache  mtu 1500 advmss 1460 hoplimit 64

# ip route list      
100.126.1.0/24 dev eth0  proto kernel  scope link  src 100.126.1.100
192.168.2.0/24 dev eth1  proto kernel  scope link  src 192.168.2.1
10.0.2.0/23 dev eth1  proto kernel  scope link  src 10.0.2.8
169.254.0.0/16 dev eth0  scope link  metric 1002
169.254.0.0/16 dev eth1  scope link  metric 1003
default via 100.126.1.1 dev eth0 

part 6 docker from development to production

docker run --name coolwordpress -v /host/directory:/container/directory --link  anothermysqlCnt:mysql -e WORDPRESS_DB_PASSWORD=p@ssw0rD -d -p 8080:80  wordpress:4.6.1-apache