Skip to main content
Known Participant
July 15, 2009
Question

Setting up a MySQL datasource in CF, please help!

  • July 15, 2009
  • 1 reply
  • 902 views

I have installed CF using the Multi Server option, and I have installed MySQL 5 on my Mac OSX 10.5.  I downloaded and installed the ODCB driver and installed it (created a portfolio and a new test db) and also created a username and pw for MySQL.  I tested the ODCB and the MySQL connections per the Terminal per the instructions.

I did a lot of the install per instructions, but don't quite understand how the driver the database server and CF interact with each other.  Like if I have an .sql db (which I do) that I want CF to use, what do I use for "Server" when I am setting it up and where do I put the actual SQL file?  /usr/locl/mysql?

I am really just trying to learn CF and I want to setup a DB and I would like to use MySQL but does it matter which driver I use?  I downloaded the MySQL J connector, but have not installed.  Do I need it if I have the ODBC?

I know I'm kind of all over the place, but any help would be appreciated.  I just want to be able to go into CF Administrator and setup a datasource using an existing .sql file.

Mike

    This topic has been closed for replies.

    1 reply

    July 15, 2009

    I have a VM running with Leopard Server running CF8 and MySQL (not the version included with Leopard) and it works fine. I didn't install any special drivers or anything. You don't use the .sql file as the datasource, you use the MySQL DB name, not the .sql file.

    First off, install this version of the MySQL server:

    http://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg

    It will install a Preference Pane, make sure Automatically Start MySQL Server on Startup is checked and check that MySQL is running.

    To make sure your database exists, in Terminal, enter these commands:

    mysql -u root

    SHOW DATABASES;

    Once you get the name of your database, use that name in the Database field in the Add New MySQL Datasource inteface in the CF Admin.

    I use Navicat Lite MySQL as a GUI frontend to MySQL. http://www.navicat.com/download/download.html

    Are you using server edition? CF8 has some issues with Leopard client I believe.

    depth10Author
    Known Participant
    July 15, 2009

    Thanks for responding.  Yes, I downloaded the MySQL 5.1.36 dmg and installed and checked the preference pane and it is up.  I even checked the databases and I have already created one called 'mydb' with a DSN in ODBC called 'mydbportfolio'.  When I go into the CF Admin, it asks for a DataSource name, so I name it, say, 'testdb'.  Then I click Add after choosing MySQL (4/5).

    For Database, I use the mydb but for Server what do I use?  And, for username I have a username and pw already setup.  So I really just need the Server.  What do I put there?

    I do know, that my http://localhost:8080 is pointing to /Users/[username]/Sites, which is how I set it up.

    Thanks

    Mike

    Inspiring
    July 15, 2009

    Mike,

    In the CF Administrator, you would use localhost for the server, 3306 for the port (the port should be auto-filled, if I recall!). The username and password are typically root (username) and whatever password you supplied during the install/setup.

    That's really all you should need to connect. I've used CF7 and CF8 on my Mac (from OS X 10.4.x through to my current, OS X 10.5.7) with MySQL 5 for a couple years now, no issues.

    Once you include the server, root (or other base usename you created) and the password from your setup, you should be able to add the DSN and verify it in the CF Administrator.