Connecting to MySQL with Dreamweaver MX

From Lunarpages Web Hosting Wiki
Jump to: navigation, search

You can use a PHP page in Dreamweaver to connect to your MySQL database. First make sure you have already created a MySQL database and user, and have assigned the user to the database.

When you set up your site in Dreamweaver make sure these are your settings:

Local info

  • Site Name: Whatever you like
  • Local Root Folder: Navigate to where you keep your files for the site on your home computer
  • HTTP Address: http://yourdomainname.com/

Remote info

  • Access: FTP
  • FTP Host: yourdomain.com or servername.lunarpages.com (change to your domain or server name)
  • Host Directory: public_html/ (or public_html/subfolder/ for addon domains)
  • login: Lunarpages username
  • password: Lunarpages password
  • Check the box for use passive FTP
  • Do NOT check the box for use firewall (very important!)
  • As far as check in/check out, unless you have some specific reason to do so, do not check any of these boxes.

If you Click test after you set up these settings, you should be able to connect.

Testing Server

  • Server Model: PHP/MySQL
  • All other settings should be the same as in the Remote Info, except for URL Prefix: http://yourdomainname.com

Database Connection

  • Now create a PHP page by clicking on New > Dynamic Page > PHP, or open an existing PHP page.
  • Open the Applications panel.
  • The first three of four steps should have check marks next to them.
  • For step four, click the "+" button, and select MySQL connection from the drop-down list.
  • Connection name: whatever you would like to name it - it doesn't matter.
  • MySQL Server: localhost (for cPanel) ServerIP (for LPCP)
  • Username: database username
  • Password: database password

Database: click "select" and in a few seconds (depending on your connection speed) you should get a list of available databases you can connect to.

Share |
Want to read this in another language?