What is a MySQL Database?
A MySQL database is an open source database management system that is used and offered by most web hosting services. By definition, a database is a well structured collection of data that ranges from the most basic to the most complex, such as from a simple name list to a collection of vast amounts of information. Just like a physical data bank, databases are used to provide ease and organization in the collection and retrieval of data.
MySQL databases are relational databases which mean that they store data in store data in separate tables rather than just put all of them in one large storage room. The advantage of this type of database is that data storage and retrieval are very efficient as files are organized into specific storage locations. In fact, the term SQL stands for “Structure Query Language” and has since become the most sought after data access language.
How can I create a MySQL Database?
Running a lot of applications such as software for eCommerce, CMS applications and forums often require a MySQL database. As such it is vital to create one in your system.
MySQL database creation is a three step process; the first being the creation of a database user and password, the second process is assigning privileges to a user to access the database and the third, the actual creation of the database. This may sound a bit daunting but with the use of the MySQL Database Wizard found in your cPanel, the task of database creation becomes fast, simple and easy. Just follow the succeeding steps:
- First, you need to login to your cPanel;
- Next, click the “MySQL Database Wizard” which can be found under the heading “Databases”.
- Then next to the “New Database”, you need to enter the name of your database;
- Next, click the button “Next Step”;
- You will be asked to enter your username next to the tab “Username”;
- Then, you also need to enter a password next to the “Password” tab. You are required to enter the password twice and then click “Create User”;
- Next, you need to assign your user with the privileges to your database. You may simply click “All Privileges” unless otherwise specifically requested by a developer.
- After setting the privileges, you need to click the tab “Next Step” which shall in effect complete the setup process. Notice that your database name and database user uses the cPanel username as prefix. Should you need to create additional databases, all you have to do is to repeat the process listed above.
Can I export a MySQL Database in phpMyAdmin?
There are times when you do find the need to make a backup of your database, either as a security measure or as a requirement during the transfer process of your website to another server. Actually, database backups are easily done through exporting it by using phpMyAdmin, a tool that can be found in your cPanel. To export, simply do the following steps:
- Login to your cPanel.
- Under the heading “Databases”, click the phpMyAdmin icon and then select the database you want to export from the list on the left menu by clicking it.
- Then, click the “Export” tab that can be found on the menu at the top of the page.
- Under the heading “Export”, check below the “View dump (schema) of database” and make sure that all of the tables as well as the SQL option are selected.
- Then, under “Structure”, enable the option “Add DROPTABLE/VIEW/PROCEDURE/FUNCTION” and make sure that the “Save as file” that is found at the lower left of the page is selected. Take note that if your database is quite large, you may choose either “zipped” or “gzipped” for a much quicker download.
- Click the “Go” button at the bottom right and then click “Save” when prompted. This action starts the download process into your local computer.
How to import to a MySQL Database in phpMyAdmin?
While there is a need to export a database, you also find the need to import one from another server into your server. To do this, you can also use the phpMyAdmin. However, to import it, you need to have a database backup file which usually takes the extension “.sql” although .zip and tar.gz are also accepted. To import a file, you need to do the following:
- Login to your cPanel.
- Once logged-in, click the phpMyAdmin icon that shall be found under the “Databases” of your cPanel home screen.
- Then, select the database that you want to import from among the list on the left menu.
- On the top menu, click the “Import” tab.
- Then, under the “File to Import”, click the “Browse” button and then find your database backup file.
- Then click on the “Go” button on the bottom right of your screen to start the import process. Once the import is complete, you should see a green check mark under the tabs and a notification that should say something like this, “Import has been successfully finished.