Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In addition to posting your php files on your web site, you also need to create a copy of your database on your remote server. The particular installation of MySQL will depend on how you're using your server on the remote site. In many cases, your database is created for you by your Internet Service Provider or by your web site manager, but it's up to you to create an SQL script that you can run to re-create your database structure remotely. In this video, I'll show you how to create the script using phpMyAdmin.
If you're working with WampServer on Windows, you can open up phpMyAdmin from the admin menu. And if you're working on MAMP on Mac OS X, go to the MAMP homepage and then click phpMyAdmin. From there, click into your database. My database is named explorecalifornia and then click Export at the top of the table list. In the Export Screen, you're asked which tables you want to export. I'm going to select all of the tables. Then there're some options you need to look at.
You'll want to output the SQL format - that's the default - and then under Options, click the option to add a drop table view, and so on. This means that when you run the script, if a particular table structure already exists, it will be replaced. There are other options that you might want to include. For example, if you want a fresh, clean database, you can uncheck the Data option, and then you'll only get the structure, or you can add the data option and then go into the resulting SQL script and make any changes you need to.
At the bottom of the screen, check Save As file, and you'll be prompted when the file is supposed to be saved. Click Go. Now, depending on which browser you're working in, you'll either see this dialog, or you'll see that the file is automatically saved. I'm going to select Save File and click OK. In Firefox, the file is automatically created in your downloads folder. If you're working with Internet Explorer on Windows, you'll be prompted for the location where you want to save the file.
Working in Firefox, I'll right-click on the file reference, and choose Open Containing Folder, and then from there, I'll right-click and open the file. I'm using TextPad, but you can use whatever text editor you want. The file will include all of the data structure and actual data. If you don't want to include actual data in a table, there are two steps to follow. First of all, go to the insert statements, under the dumping data comment, and delete them. And then, go back to the table structure and change the auto increment value from whatever it's set at to a value of 1, and that means when the first record is inserted, the primary key value will be 1.
You can also make changes such as the database engine, which is done on a per- table basis and any other changes that you want to make. Once you've created the SQL file, save it, and you'll be ready to move on to the next step, importing the file into your remote database, which I'll describe in another video.
Get unlimited access to all courses for just $25/month.Become a member