The following picture will appear
Host: Mysql database ip example: 127.0.0.1
Port: Port for accessing Mysql Example: 3306 (Mysql default port)
User: User example for logging into Mysql: root
Password: Password for logging into Mysql Example: abc@!123
Click Apply after completion. Can
Press Ctrl Shift F10 and select the console (default) to start using our database.
Use our Sql syntax here for a simple and easy learning process
We can use the create command to create a database after logging in to the MySQL service. The syntax is as follows:
CREATE DATABASE 数据库名;
For example, creating a study library is
CREATE DATABASE study;
After completion, you can You can see the study library in the side view
Of course we can also right-click the data source and select New, then select the architecture to create a new database
We can use USE to select the Mysql database to be operated. After using this command, all Mysql commands will only target this database.
USE 数据库名;
For example, choosing the study library is
USE study;
After completion, you will see in the upper right corner that we have selected the study library
Of course we also You can choose to click the drop-down box to directly select the database you want to choose
We can use USE to select the Mysql database to be operated and use this command All subsequent Mysql commands are only targeted at this database.
SHOW DATABASES:;
After completion, you can see all our databases below
Of course this is exactly the same as the database under our data source on the left
The above is the detailed content of How DataGrip connects to Mysql and creates a database. For more information, please follow other related articles on the PHP Chinese website!