Working with the database

1) To backup the database in phpMyAdmin, select "Export". Check "Save as File". To the "File Name template", append %F_nameofsiteofthisdatabase. Where %F appends current date to the filename, and name... is the name of the site that the database contains.

2) If you install a copy of a site in a subfolder (for upgrade purposes, etc), you will need to point that installation to a copy of the database, and not the same database that the original site ran on. Create an empty database thru your hosting. Then use the SSH procedure below to import a copy of your old database into the new one. For CMSMS, to avoid the wrong encoding and the Å character, you must not leave the default UTF-8 encoding on the last step (step 6 or 7), but must view the database in phpMyAdmin, and input the encoding that you see listed for database tables into the CMSMS installer.

 

========================

The process above was trivial on a local XAMPP database's phpMyAdmin interface. However, it is far from trivial on my 1and1 phpMyAdmin 2.6.4-pl3 mySQL 4.0 hosting. The following is what works for me, and is just for starting information. You should research and confirm everything for yourself. I do not claim this to be a working, easiest, or the right way. It is simply the only way that I have found to work.

1) Export the database. Go to phpMyAdmin, on the page that appears, look for "Export". Check "Save as file", Compression=None, and Add DROP DATABASE. Save the file to your computer.

2) I do not know about other hosting providers, but at least with 1and1, I have a problem with different database names. Every time I create a database, the database name is a random one. Therefore, when you will be trying to import a database into another one with a different name, you will not be able to do it. For example, if your old database is named db788 and your new empty one is db790, then open the exported file that you saved in a text editor like WordPad, and replace all "db788" entries within with "db790".

3) Upload the modified database export file to your server.

4) Connect to the mySQL server thru SSH by using the credentials that your hosting provider has given you. Run the command

mysql -h host_name -u user_name -p database_name < dump_file.sql

and then supply your password. In the example above, database_name is db790, and host_name and user_name are the credentials for the database db790. The problem that we are trying to avoid with the WordPad solution is the fact that if the file dump_file.sql contains table/database entries of the form "db788", THEY WILL NOT IMPORT INTO DATABASE NAMED db790.



˅˅˅ Additional valuable information is available at one of the links below: ˅˅˅

 

Did you like the article? Let Google Search know by clicking this button: . Please link to content that you find useful on this website on your own website, forum or blog! You can also comment on this page below, or to ask a question or suggest a topic for me to research. There is a user-editable Wiki available on my website, as well as a Forum that you can contribute to. Site Map.

Page last modified 08-Aug-10 18:18:58 EDT
Comments on this page: