Home >Database >Mysql Tutorial >Analysis on the use of MySQL basic entry operation commands

Analysis on the use of MySQL basic entry operation commands

黄舟
黄舟Original
2017-08-01 10:55:551295browse

Here I will introduce the basic operation commands of mysql that we often use in daily work. The main reason why mysql database is more popular now is that it is free. Both enterprises and individuals can use it. Second: Convenience Installation is convenient for personal management. Other things such as stability, speed, and security, I think every data needs to have this attribute. Generally, enterprise mysql is fully capable of this level.

1. General situation The construction of mysql is to build a table with rows and columns like this. Multiple tables or a table organization are called a database. Basically, we will first see that there are many databases in the directory under mysql, which requires us to know Our table exists in that database so that we can find it easily and quickly.

Analysis on the use of MySQL basic entry operation commands

2. Enter the mysql management window command. Generally, we enter msyql in the command window: When it appears that mysql is not an internal or external command, it means that you have not added the msyql command to the system configuration at this time, that is, the environment variable. At this time, you need to complete the configuration process. After the configuration is completed, the data mysql command will appear as follows, When you enter the data mysql -u username -p password, you can enter the management interface

Analysis on the use of MySQL basic entry operation commands

3. Under normal circumstances, we will first list how many databases there are to facilitate our search. Our own database. We can use the command: show databases; hence the name, it displays all databases, as shown in the figure:

4. When all databases are listed, we find the one we created ourselves Database name, at this time we definitely want to enter it and find the tables we need, then we can use the command: use database name;

show tables to list all table information. We can then find what we need Which table.

Analysis on the use of MySQL basic entry operation commands

5. If you want to view the structure of the table or what fields are in the table, we can use the command desc table name; if you want To view the contents of the table, you can use the query command select * from table name: all the list information of this table will be listed.

Analysis on the use of MySQL basic entry operation commands

Analysis on the use of MySQL basic entry operation commands


6. Similarly, we can also execute delete, update, and add commands:

Delete:

delete from 表名 where 字段=?

Remember to delete normally In this case, we will give a condition. If we don't give the condition, it will be the entire table.

Update:

update biao set 字段=? where 字段=?

Which table to update which piece of information

Add

insert into table name (field) value (value) format:

As shown in the picture:

Analysis on the use of MySQL basic entry operation commands

The above is the detailed content of Analysis on the use of MySQL basic entry operation commands. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn