Home  >  Article  >  Database  >  How to integrate idea with mysql

How to integrate idea with mysql

藏色散人
藏色散人Original
2020-11-01 15:46:103900browse

Idea method to integrate mysql: first open the database tool window; then click the add button " " in the upper left corner of the Database tool window and select the database type MySQL; finally download the relevant files and fill in the host name, database name, Just a username and password.

How to integrate idea with mysql

# Recommended: "

mysql video tutorial

1. IntelliJ IDEA integrates MySQL database

    Menu View→Tool Windows→DatabaseOpen the database tool window

  1. How to integrate idea with mysql
  2. Click on the Database tool Add a button " " in the upper left corner of the window, select the database type MySQL

  3. How to integrate idea with mysql
  4. , you will be prompted to download the relevant files, fill in the host name, database name, user name and password of the database connection

  5. How to integrate idea with mysql
  6. Click the
  7. Test Connection button to test whether the database connection is normal. The test may report an error as follows:
    Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone' property manually. Please continue reading below for the solution
2. Solve the problem Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone' property manually.

How to integrate idea with mysql

  1. Reason: China's time zone is UTC-8, which is exactly 8 hours behind Greenwich Mean Time. MySql's default time zone is UTC time zone, which is 8 hours behind Beijing time. hours, resulting in a time zone error, so the time zone setting of MySql needs to be modified.

  2. Solve the time zone error problem:


    win R, bring up the Dos window, start mysql

    # 查看时区show variables like '%time_zone%';# 设置时区set global time_zone = '+8:00';

    Set the time zone successfully, Check the time zone again, the display is as follows
    Note: mysql needs to be restarted to view
    How to integrate idea with mysql

  3. Click again

    Test Connection button to test whether the database connection is normalHow to integrate idea with mysql

  4. Later I found that this seemed to be a temporary solution and could not be solved at once. Let’s update the content directly in IDEA Modify the value of


    How to integrate idea with mysql
    serverTimezone to: Asia/Shanghai or
    Hongkong or Asia/Hongkong
    How to integrate idea with mysql

  5. Learn to use SQL to create a library on IDEA. The following provides a data table creation

    jd.sqlTest

    DROP database IF EXISTS `jd`;create database jd;use jd;DROP database IF EXISTS `jd_item`;CREATE TABLE `jd_item` (
      `id` bigint(10) NOT NULL AUTO_INCREMENT COMMENT '主键id',
      `spu` bigint(15) DEFAULT NULL COMMENT '商品集合id',
      `sku` bigint(15) DEFAULT NULL COMMENT '商品最小品类单元id',
      `title` varchar(100) DEFAULT NULL COMMENT '商品标题',
      `price` bigint(10) DEFAULT NULL COMMENT '商品价格',
      `pic` varchar(200) DEFAULT NULL COMMENT '商品图片',
      `url` varchar(200) DEFAULT NULL COMMENT '商品详情地址',
      `created` datetime DEFAULT NULL COMMENT '创建时间',
      `updated` datetime DEFAULT NULL COMMENT '更新时间',
      PRIMARY KEY (`id`),
      KEY `sku` (`sku`) USING BTREE) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='京东商品表';
  6. Right-click the sql, and after execution, the database

    jd and the data table jd_item
    How to integrate idea with mysql

  7. will appear on the right.

The above is the detailed content of How to integrate idea with mysql. 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