Unable to connect to Database using MySQLdb in Robotframework
-
27-10-2019 - |
Question
Using Robotframework 2.6.3 and the python database library, I want to connect to MySql Database.
I have downloaded the DatabaseLibrary and MySQLdb however when I try to connect using:
Library DatabaseLibrary
DatabaseLibrary.Connect To Database MySQLdb cts1 root password 172.16.7.20
I get the following error, when I run this using pybot:
OperationalError: (2003, "Can't connect to MySQL server on '172.16.7.20' (10061)")
Note: cts1 - is the DB name and 172.16.7.20 - is the IP address of DB.
This works when I use mysql under the command prompt. Why would it not be able to connect?
Solution
The issue was I did not provide any PORT into robotframework and it does not correctly use the default port of 3306. Once I put the port in, it worked.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow