Yes, having outdated components on your system can pose a security risk. Attackers often target outdated software that has known vulnerabilities, as these vulnerabilities can be exploited to gain unauthorized access to a system or to steal sensitive information.
Even though Java is not installed, if it is present on the system, it can still be a target for attackers. Attackers can use known vulnerabilities in outdated versions of Java to gain access to your system, even if the application that uses Java is not currently running.
Therefore, it's important to keep all software on your system, including Java and MySQL, up to date with the latest security patches and updates. Additionally, if you're not using certain components, it's best to uninstall them completely to reduce the attack surface of your system.