1. Introduction:
Phpstorm is a lightweight and convenient PHP IDE that provides smart code completion, fast navigation, and instant error checking, which greatly improves coding efficiency. Its unique development convenience, in a short period of time to win a large number of phper favor. MySQL is a relational database management system (RDBMS, relational database Management system) developed by the Swedish MySQL AB company, currently owned by the Oracle company. A relational database is an increase in speed and flexibility by keeping data in separate tables rather than putting all of the data in a large warehouse. In WEB applications, MySQL is one of the best relational database management system applications, with a global market share of around 23%, second only to Oracle. The key is MySQL open source free, with PHP and Apache to form a good development environment. Able to operate the database in the development artifact Phpstorm, the development efficiency will certainly be higher.
2. Configure the operation steps:
2.1 Open Database
Select View->tool windows->database click Open. 2.2 Add data connection Select "+"->data source->mysql click Open, then select "+"->mysql click to open. The first time you open will prompt the MySQL driver is not installed, click on the download, will be installed automatically. 2.3 fill in the configuration parameters fill in the database connection name, database address, database name, user name, user password. Click Test Connection. Where the database name if forgotten, you can not fill out, the display will be the data connection in all databases. You can select the database you want to display in the tab schema&tables (tick). The test succeeds to see the database, the data table, and its table structure. In the process, if you enter a password, you can enter it again. At this point, the configuration work is complete. 3. Frequently used data operations: 3.1 the contents of a table by adding and removing a check double-click to open the datasheet, "+" to add a piece of data, "-" delete a piece of data, Ctrl + F to find the data, Double-click the content you want to change, and enter to determine the change. 3.2 adding Adding to Table fields: Select the table you want to manipulate, right-new->column Click Select, enter field name, field type, select Field Properties, click OK. You can also see the SQL statement below. Delete: Select the field name and right-click Delete. Change: Select the field name and right-click Rename. 3.3 adding Adding to the table itself: in the database area, right-new->table click Select. Name the table and click "+" to add the field. Delete: Select the table name and right-click Delete. Change: Check the name of the table, right-click Rename. 3.4 adding Adding to Schema: Right-click New does not find the schema? Not found on the right, Phpstorm to provide users with direct SQL function, after all, the number of direct operation of the database is limited, do not do a graphical interface is excusable. In addition, as a program ape, can't forget the SQL statement is not? Anyway: Click on the QL logo, if you want to create a database named ceshi666, enter create Databas in the open pageE MyApplication; (or create SCHEMA ceshi667; the same as the effect, the following will be nagging a few words) click on the top left corner of the green triangle button to complete the creation of the database. Not displayed? Click on the wrench above, find the tab schema&tables, select the new database ceshi666, tick. Delete: Enter Drop DATABASE ceshi666, click the triangle to execute. : What if I want to change the name of the database? Direct rename DATABASE ceshi666 to ceshi999;? Sorry, this syntax was added in MySQL 5.1.7, and 5.1.23 was removed. How do I change the database name without rename syntax? There is a way. First: Create a new ceshi999 database, then rename all the tables in the original database, and finally delete the original database. create database ceshi999; RENAME table ceshi666.table1 to ceshi999.table1,ceshi666.table2 To ceshi999.table2;drop DATABASE ceshi666; 4. Some basic concepts: what is the difference between create database and create schema in 4.1mysql? The answer is: no difference. In mysql5.5 's English document, the official said: CREATE database creates a database with the given name. To use this statement, you need the CREATE privilege for the database. The Create SCHEMA is a synonym for create database. Translation: Create databases is used for creating and naming. If you want to use CREATE database, you need to get the Create permissions for the databases. The Create SCHEMA is a synonym for create database. 4.2database I understand, what exactly is the schema? schema is the product of Oracle, MysThere was no such concept in QL, which was acquired by Oracle, but with the same meaning as database. The official definition Schema in Oracle is as follows: a schema is a collection of the database objects (used by a user.). Schema objects is the logical structures that directly refer to the database ' s data. A user is a name defined in the database that can connect to and access Objects.schemas and users help database Administra Tors Manage Database Security. From the definition we can see that the schema is a collection of database objects, in order to distinguish the various collections, we need to give this collection a name, these are the many similar user names that we see under the Enterprise Manager scenario, these nodes are actually a schema. The following is a netizen playing analogy: "First to do a metaphor, what is database,schema,table, column, line, user?" The database can be regarded as a large warehouse, the warehouse is divided into a lot of rooms, the schema is the room, a schema represents a room, table can be regarded as a bed in each schema, table (bed) is placed in each room, Cannot be placed outside the room, it is not night sleep homeless ah. Then the bed can be placed a lot of items, like table can be placed a lot of columns and rows, the database is stored in the basic unit of data is a table, in reality each warehouse place the basic unit of the item is the bed, user is the owner of each schema, (so the schema contains the object, Instead of user), the user is corresponding to the database (that is, the user is the owner of each corresponding database), since there is the right to operate the database (warehouse), there must be operational database of each schema (room) right, That is, each database mapping user has a key to each schema (room), in other words, if it is the owner of a warehouse, then the use of the warehouse and everything in the warehouse is his (including the room), he has the full operation right, can throw away the unused things from each room, can also put some useful things into a room, this reality is similar, I can also assign the user specificPermissions, that is, what he can do in a room, is only to see (read-only), or can have all the control (R/W), like the owner, this depends on the role of the user roles. " 5. Summary: above introduces some methods of operating database in Phpstorm, and most of the operations used in the development are those. But phpstorm to the database of the operation than the professional database software is also somewhat inferior, such as adding field notes inconvenient, data import and export inconvenient. Plus, you are welcome to add more efficient database operations. If you like it, it's great to have a nice point.
How to use the database tool in Phpstorm, and how to do it in detail