HTML5 and CSS3 All-in-One For Dummies
Book image
Explore Book Buy On Amazon

HTML5 and CSS3 websites often work with databases. Your hosting service may have features for working with MySQL databases remotely. You should understand how this process works because it's often slightly different from working with the database on your local machine.

Create your database

Often, a tool allows you to pick a defined database or create a new one.

image0.jpg

This database creation step happens because you don't have root access to MySQL. Instead, you usually have an assigned username and database name enforced by the server. On Freehostia, all database names begin with the username and an underscore. To create a new database, you need to provide a database name and a password. Usually, a MySQL user is created with the same name as the database name.

After you create the database, you can select it to work with the data in MySQL.

image1.jpg

Often, public servers remove the Privileges section because you aren't logged in as root. Everything else is basically the same.

How to find the MySQL server name

For many situations, you can ssume that the MySQL server is on the same physical machine as the web server. This situation is common in XAMPP installations, but commercial servers often have separate servers for data. You may have to dig through the documentation or find a Server Statistics section to discover how your PHP programs should refer to your server.

By far the biggest problem when moving your programs to a remote server is figuring out the new connection. Make sure that you know the right combination of server name, username, and password. Test on a simple PHP application before working on a complex one.

About This Article

This article is from the book:

About the book author:

Andy Harris taught himself programming because it was fun. Today he teaches computer science, game development, and web programming at the university level; is a technology consultant for the state of Indiana; has helped people with disabilities to form their own web development companies; and works with families who wish to teach computing at home.

This article can be found in the category: