• idea连接mysql数据库


    idea连接mysql数据库:Database 》》》 +【New】 》》》 Data Source 》》》 MySql  弹出配置框 如下

     填写数据库【Data Sources】信息: database输入框里面填写要连接的数据库名称。如果本地有数据库驱动包 可以配置一下【Drivers】如下(没有的话可以不用管,会自动默认下载)

     配置完驱动【Drivers】后,【Test Connections】测试连接,此时出问题了【报错:Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone' property manually. 】

    时区错误,MySQL默认的时区是UTC时区,比北京晚了8个小时,所以要修改mysql的时长
    window环境下:
    打开cmd,进入到mysql安装目录下的bin目录(配置了环境变量不需要进入bin目录)
    输入以下命令
    mysql -hlocalhost -uroot -p
    输入MySQL的数据库连接密码
    执行以下命令
    set global time_zone='+8:00';

    C:Userszhangchenxin>mysql -hlocalhost -uroot -p
    Enter password: ********
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 49
    Server version: 8.0.20 MySQL Community Server - GPL
    
    Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    mysql> show variables like'%time_zone';
    +------------------+--------+
    | Variable_name    | Value  |
    +------------------+--------+
    | system_time_zone |        |
    | time_zone        | SYSTEM |
    +------------------+--------+
    2 rows in set, 1 warning (0.03 sec)
    
    mysql> set global time_zone = '+8:00';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql>

    再次【Test Connections】测试连接成功!

    连接后发现看不到数据库表结构 如图:

     需要设置一下 右键单击"schemas", 选择Database Tools 》》》 Manage Shown Schemas…,然后就能看到数据库下面的所有schema,选中要显示的后,确定。如图

     就可以看到想看的表了!

  • 相关阅读:
    mybatis配置
    mybatis 多表查询 与配置
    Maven中资源导出问题解决方案--pom.xml配置
    【macOS】Mac App Store 无法 更新/下载
    【macOS】删除 Mac 上的 Office 许可证文件
    【前端】JavaScript学习笔记(一)——快速入门
    【前端】CSS3学习笔记(五)——定位
    【前端】CSS3学习笔记(四)——浮动
    【前端】CSS3学习笔记(三)——盒子模型
    【macOS】清除Finder 「前往」(⌘
  • 原文地址:https://www.cnblogs.com/zcx-94/p/14252459.html
Copyright © 2020-2023  润新知