Operate the database in the visual interface of the phpMyAdmin graphical management tool
- Create a database
- New data table:
After successfully creating a data table, define and edit its structure data, including: data name, data type, data length, attributes, data comments, etc., and finally "save". as follows:
- Modify the data table:
After the data table is created, its structure can be changed, such as modifying a single attribute, adding, deleting, etc.
- Delete the data table, delete the database, all in "operation":
Use SQL statements to manipulate data tables
- Use SQL statements to insert data:
Use insert statements in the SQL statement editing area to insert data into td_admin, click "Execute"
For example: id = 1, name = www.php.cn, pwd = 12345
- Use SQL statement to modify data:
Use update statement to modify data information in SQL editing area
For example: id = 2, name = phpChinese, pwa = 54321
- Use SQL statements to query data
Use select * to query data information at the SQL editing site:
First, we need to compile a few more data so that the last query, and the same as the initial insert data, now there is a data, for example, add 4 more data , Id = 1, name = www.php.cn, pwd = 12345;
id = 3, name = www.baidu.com, pwd = 111;
id = 4, name = google.com, pwd = 222;
then use select * Statement for query:
for example: find the one with id <2
- Use SQL statement to delete data:
Use delete to delete data information in the SQL editor:
for example: delete the data of name = google.com
Tips: If there is no where conditional statement after the delete statement, then all data in the specified data table will be deleted.
Management data records
- Insert data:
for example: insert www.firefox
select data table- > insert- > add data-> execute
- Search data:
Import and export data tables
Import and everywhere are two opposite operations. Import is to import the file with the extension name .sql on the computer into the phpmyadmin database, and export is to save the data table structure and data records in the database as .sql. Save the file with the suffix on the computer. By importing and exporting, we can backup and restore the database.
- Export data:
select the data table to be exported, and then export
- Import data:
select the database, and then import
Tips:
before importing the data, make sure that there is a database with the same name as the original database of the imported data in phpmyadmin, for example, if there is a database of php.cn, if not, create a new one; If there is a data table with the same name as the data to be imported in the database, the import will fail.