Home > Database > Mysql Tutorial > body text

How DataGrip connects to Mysql and creates a database

WBOY
Release: 2023-06-03 11:19:06
forward
7417 people have browsed it

    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 数据库名;
    Copy after login

    For example, creating a study library is

    CREATE DATABASE study;
    Copy after login

    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 数据库名;
    Copy after login

    For example, choosing the study library is

    USE study;
    Copy after login

    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:;
    Copy after login

    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!

    Related labels:
    source:yisu.com
    Statement of this Website
    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
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template