zoukankan      html  css  js  c++  java
  • 1、mysql 5.7 ubuntu17.04

    系统:ubuntu17.04

    数据库主要分文档型和服务型两类:

    文档型:如sqlite3 (17.04自带/usr/bin/sqlite3)就是一个文件,应用在移动端如手机,pad,家电等

    服务型:如mysql有服务端(存储数据)和客户端

    mysql数据库是关系型数据库,采用E-R模型即实体-联系(或关系)模型

    安装:

    sudo apt install mysql-server,需要设置密码:xxx

    sudo apt install mysql-client

    sudo apt install libmysqlclient-dev

    lyb@lyb:~$ sudo netstat -tap | grep mysql
    tcp        0      0 localhost:mysql         *:*                     LISTEN      5167/mysqld

    成功安装

    登录:

    l@l:~$ mysql -uroot -pxxx
    mysql: [Warning] Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 5
    Server version: 5.7.20-0ubuntu0.16.04.1 (Ubuntu)
    
    Copyright (c) 2000, 2017, 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 databases;  #初始有四个数据库
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | sys                |
    +--------------------+
    4 rows in set (0.16 sec)

    创建用户并授权:

    mysql> create user 'l'@'%' identified by '123';
    Query OK, 0 rows affected (0.09 sec)
    
    mysql> select user,host from user;
    +---------------+-----------+
    | user          | host      |
    +---------------+-----------+
    | l           | %         |
    | mysql.session | localhost |
    | mysql.sys     | localhost |
    | root          | localhost |
    +---------------+-----------+
    4 rows in set (0.00 sec)
    
    mysql> grant select on study.* to 'l'@'%';

    desc  user;  #显示其中user表的结构,如下:

    +------------------------+-----------------------------------+------+-----+-----------------------+-------+
    | Field                  | Type                              | Null | Key | Default               | Extra |
    +------------------------+-----------------------------------+------+-----+-----------------------+-------+
    | Host                   | char(60)                          | NO   | PRI |                       |       |
    | User                   | char(32)                          | NO   | PRI |                       |       |
    | Select_priv            | enum('N','Y')                     | NO   |     | N                     |       |
    | Insert_priv            | enum('N','Y')                     | NO   |     | N                     |       |
    | Update_priv            | enum('N','Y')                     | NO   |     | N                     |       |
    | Delete_priv            | enum('N','Y')                     | NO   |     | N                     |       |
    | Create_priv            | enum('N','Y')                     | NO   |     | N                     |       |
    | Drop_priv              | enum('N','Y')                     | NO   |     | N                     |       |
    | Reload_priv            | enum('N','Y')                     | NO   |     | N                     |       |
    | Shutdown_priv          | enum('N','Y')                     | NO   |     | N                     |       |
    | max_user_connections   | int(11) unsigned                  | NO   |     | 0                     |       |
    | plugin                 | char(64)                          | NO   |     | mysql_native_password |       |
    | authentication_string  | text                              | YES  |     | NULL                  |       |
    | password_expired       | enum('N','Y')                     | NO   |     | N                     |       |
    | password_last_changed  | timestamp                         | YES  |     | NULL                  |       |
    | password_lifetime      | smallint(5) unsigned              | YES  |     | NULL                  |       |
    | account_locked         | enum('N','Y')                     | NO   |     | N                     |       |
    +------------------------+-----------------------------------+------+-----+-----------------------+-------+

    注:字段创建要有数据类型,长度;Null是否为空,NO表示不能为空;PRI表示主键,一般是一个,本表前两个是联合主键

    select  字段  from  表

    exit;  #从mysql数据库退出

    ps -ef |grep mysql  #在命令行从所有进程筛选mysql

    渐变 --> 突变
  • 相关阅读:
    不可编辑属性
    按钮事件--嵌套事件(冒泡)--带参数事件--双向数据绑定
    微信-文件组成-模块作用--定义全局方法变量---数据绑定--wx:for循环列表
    自定义指令----focus获取焦点事件
    处理字符串
    Vue-过滤器filters--数据处理--主要用于时间格式化
    MVC系列教材 (二)- 结合Servlet和JSP 实现查询功能
    MVC系列教材 (一)- 教程
    JSP系列教材 (十一)- EL表达式语言
    JSP系列教材 (十)- JSTL Java Standard Tag Library 标准标签库
  • 原文地址:https://www.cnblogs.com/lybpy/p/8001769.html
Copyright © 2011-2022 走看看