• MySql基本操作


    MySQL:应用场景(互联网企业,扩展性强)
    mysql 是一个客户端命令

    quit 退出

    mysql -u 'tedu@192.168.0.199' -p

    c 退出当前行输入

    status; 显示基本信息

    //建库
    create database ttms_lmg default character set utf8;
    //建表
    create table t1 if not exists t1(
    -> id int primary key,
    -> title varchar(50),
    -> createtime datetime);

    //建表后修改字符集
    alter database ttms default character set utf8;

    //更改字符集
    create database aaa;
    set names utf8;
    use aaa;

    //添加判断,表存在则删除
    drop table if exists t1

    数据库表数据的CRUD操作
    insert select update delete

    //使用帮助文档,使用help等价与?
    ? drop database ?create database ?int ?bigint
    ? function 查看系统中有那些函数
    ? now

    select now(); 显示当前时间

    insert into t1 (createtime)values (now());

    set foreign_key_checks=0; 设置不检查外键约束

    set names utf8;
    source d:/ttms01.sql 引入外部.sql文件(window系统下)
    source /home/soft01/test.sql; (linux系统下)

    ======================================================================

    【====Linux系统配置启动MySQL=====】

    [soft01@cpe-172-88-7-187 桌面]$ su root;
    密码:tarenamiszhengzhou


    [root@cpe-172-88-7-187 桌面]# rm -rf /var/lib/mysql/mysql.sock;
    [root@cpe-172-88-7-187 桌面]# service mysqld restart;
    停止 mysqld: [确定]
    正在启动 mysqld: [确定]
    [soft01@cpe-172-88-7-187 桌面]$ mysql -uroot;

    Welcome to the MySQL monitor. Commands end with ; or g.
    Your MySQL connection id is 2
    Server version: 5.1.71 Source distribution

    Copyright (c) 2000, 2013, 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> Ctrl-C -- exit!
    Aborted
    [soft01@cpe-172-88-7-187 桌面]$

  • 相关阅读:
    洛谷 P2260 [清华集训2012]模积和 || bzoj2956
    Mass Change Queries Codeforces
    Single-use Stones Codeforces
    洛谷 P4503 [CTSC2014]企鹅QQ
    洛谷 P1463 [HAOI2007]反素数
    Bear and Tower of Cubes Codeforces
    洛谷 P1593 因子和 || Sumdiv POJ
    记一次服务器inodes数报警的事件
    MySQL参数详解
    Django基础流程
  • 原文地址:https://www.cnblogs.com/lmg-jie/p/7596930.html
Copyright © 2020-2023  润新知