From ColdFusion if we need to connect to any database then we need to create datasource in ColdFusion server administrator. When we need to create datasource in ColdFusion 7 admin to connect to MySQL 4.1 or any higher MySQL version database we need to use the default MySQL Driver (from the list of driver options provided by ColdFusion 7). But it will throw an error, because the default driver is not supported in higher versions of MySQL.
The error occurs due to the fact that from MySQL 4.1 version, the authentication mechanism of MySQL has been changed, because of which older MySQL drivers would not be able to work unless and until the driver is updated to a current version or MySQL is configured to use the older authentication mechanism.
In order to connect to MySQL database with 4.1 or higher version, the following steps need to be performed:
1. Download a current version of MySQL driver
2. Unzip the zip file (if it is zipped)
3. Copy the .jar file in the ColdFusion instance to be used (into CFusionMX7/wwwroot/WEB-INF/lib/)
4. Restart the instance
5. Create a new datasource with ‘Other’ driver option
6. Enter the JDBC URL: jdbc:mysql://[host]:[MySQL port]/[database name]
7. Enter the Driver Class: com.mysql.jdbc.Driver
8. Provide the username and password for the database