Having trouble connecting existing mySQL database to Dreamfactory


#1

I have tried connecting my existing database (mySQL) to dreamfactory, but I am having trouble. I’ve tried connecting it through the Services tab, but I am unable to connect it to it. I’ve provided the DSN using my hosts’ name and port…I’m not sure what the problem could be, or what step I am missing. I have not found any step-by-step guidance for connecting an existing db.


#2

First, make sure that the bolded words here are set for your service (under the Config tab):

Driver: MySQL
Connection String (DSN): mysql:host=localhost;port=3306;dbname=db_name;charset=utf8
Username
Password

Second step is double-checking that it corresponds to the settings in MySQL. Connect to mysql on the command line and check:

  • That the database exists: show databases; should have an entry for db_name from above (something like farhads_app, not dreamfactory).
  • That the user exists: select user, host from mysql.user; should have an entry for Username | localhost if that’s what you set above.
  • The user permissions: SHOW GRANTS FOR ‘Username’@‘localhost’; and make sure that there’s an entry for GRANT ALL PRIVILEGES on db_name. TO ‘Username’@‘localhost’*.