PHP - English

Import a MySQL Database into phpMyAdmin

We’ve created a database for you for this section. Amongst the files you downloaded
there is a folder called databases. Inside of this folder is a file called
membertest.sql. MySQL Files that end in SQL can be imported into phpMyAdmin.
To do this, login to phpMyAdmin with your username and password. (The defaults
are root and leave blank for the password.) Now click the Import tab at the
top:

We’ve created a database for you for this section. Amongst the files you downloaded
there is a folder called databases. Inside of this folder is a file called
membertest.sql. MySQL Files that end in SQL can be imported into phpMyAdmin.
To do this, login to phpMyAdmin with your username and password. (The defaults
are root and leave blank for the password.) Now click the Import tab at the
top:

The import tab in phpMyAdmin

On the Import screen, click the Browse button at the top (Make sure
that the Format dropdown list at the bottom says SQL):

Browse fpr a SQL file

Now Browse to where you saved the folder that you download from our site. Double
click the databases folder and then select the file called membertest.sql:

Selecting a SQL file to import into phpMyAdmin

Click the Open button to get back to the Import screen. Now scroll down to
the bottom of the Import screen. Click the GO button to Import the database:

Importing a SQL file

You should then have a database on the left menu called membertest.
Click on the table name of members and the Browse tab at the top should
show the following:

The phpMyAdmin browse tab showing an imported database and table

The Browse tab shows that we already have two entries in the table: those with
the username test1, and testTwo. (NOTE: we haven’t encrypted the passwords,
here. We’ll discuss encryption in the next section when we tackle user authentication.)

Click on the Structure tab at the top to see how we have set this database
table up:

The structure of the database table

So we have four fields in the table: ID, username, password, and email. The
Types for these fields are tinyint, and varchar(20). The primary key is the
ID field, which is also set up to be Auto Incremented.

Whenever you create a database in phpMyAdmin, you can Export it a SQL file.
This file (database) can then be uploaded to your own web server or web hosting
company (if the hosting company gives you access to phpMyAdmin, that is).

 

In the next part, you’ll learn about something called Prepared Statements.
You’ll need your membertest database for this.

|

Kaynak : https://www.homeandlearn.co.uk/php/php13p3A.html ‘sitesinden alıntı

Yorum Yap