zoukankan      html  css  js  c++  java
  • MySQL基础操作(一)

    1. 连接数据库
    mysql -h localhost -u root -p 123456

    2. 查看数据库版本
    select version();

    3. 查看数据库支持的存储引擎和当前默认存储引擎
    show engines;

    4. 当前登录数据库的用户名
    select user();

    5. 当前用户能看到的所有数据库
    show databases;

    6. 转到指定的数据库
    use test;

    7. 查看当前数据库中的所有表
    show tables;

    8. 查看某个表的结构信息
    describe customers; -customers 为表名

    ======================================================(2016年8月31日)

    1. 创建一个名为ccdb的数据库
    create ccdb;

    2. 创建数据表
    mysql> create table MyClass(
    > id int(4) not null primary key auto_increment,
    > name char(20) not null,
    > sex int(4) not null default '0',
    > degree double(16,2));

    3. 获取表的结构
    desc myclass;
    或者
    show columns from myclass;

    数据库基础api网址:http://c.biancheng.net/cpp/html/1449.html

    CentOS是Linux的发行版之一: SecureCRT.exe软件

    修改本地数据库的密码,默认用户名为root,密码为空
    1. 查找本地安装的MySQL目录,进入bin目录
    e:
    cd MySQL
    cd bin

    // 显示当前连接的数据库
    select database();

    //update set命令用来修改表中的数据。
    //update set命令格式:update 表名 set 字段=新值,… where 条件;
    update myclass set name='Mary' where id=4;

    MySQL ALTER命令

  • 相关阅读:
    工作中的那些事(1)
    bootstrap-简单实用的垂直手风琴滑动菜单列表特效
    lua ffi简介
    CUDA常见问题与解答
    CUDA的软件体系
    CUDA并行存储模型
    基于纹理内存的CUDA热传导模拟
    函数指针 && 指针函数
    小弟在研究CUDA时出现一个问题,求解
    cuda科普像素坐标和线性偏移
  • 原文地址:https://www.cnblogs.com/lqcdsns/p/5796085.html
Copyright © 2011-2022 走看看