Home  >  Article  >  Database  >  How DataGrip connects to Mysql and creates a database

How DataGrip connects to Mysql and creates a database

WBOY
WBOYforward
2023-06-03 11:19:067428browse

    1. Does DataGrip connect to the database?

    1. Click File->New-> Data Source-> Mysql

    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

    How DataGrip connects to Mysql and creates a database

    2. Open the console

    Press Ctrl Shift F10 and select the console (default) to start using our database.

    How DataGrip connects to Mysql and creates a database

    Use our Sql syntax here for a simple and easy learning process

    2. Create and manage database

    1. Create a database

    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
    How DataGrip connects to Mysql and creates a databaseOf course we can also right-click the data source and select New, then select the architecture to create a new database

    How DataGrip connects to Mysql and creates a database

    2. Manage 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

    How DataGrip connects to Mysql and creates a database

    Of course we also You can choose to click the drop-down box to directly select the database you want to choose

    How DataGrip connects to Mysql and creates a database

    3. Display the database

    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

    How DataGrip connects to Mysql and creates a database

    Of course this is exactly the same as the database under our data source on the left

    How DataGrip connects to Mysql and creates a database

    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!

    Statement:
    This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete