• 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命令

  • 相关阅读:
    OC面向对象—封装
    OC面向对象—继承
    hdu 4612 Warm up(缩点+树上最长链)
    hdu 4604 Deque(最长不下降子序列)
    hdu 4607 Park Visit(树上最长链)
    hdu 4609 3-idiots(快速傅里叶FFT)
    codeforces 333B
    codeforces 333A
    codeforces 334B
    codeforces 334A
  • 原文地址:https://www.cnblogs.com/lqcdsns/p/5796085.html
Copyright © 2020-2023  润新知