zoukankan      html  css  js  c++  java
  • mysql 终端命令

    1、打开数据库

    /usr/local/MySQL/bin/mysql -u root -p

    2、输入root密码

    3、使用我的数据库

    use mysql

    4、查看表

    desc table_name

    5、查看端口号

    show global variables like 'port'

    6、创建表

    CREATE TABLE t1(

        id int not null,
        name char(20)
    );

    CREATE TABLE t1(
        id int not null primary key,
        name char(20)
    );

    CREATE TABLE t1(
        id int not null,
        name char(20),
        primary key (id,name)
    );

    CREATE TABLE t1(
        id int not null default 0 primary key,
        name char(20) default '1'
    );

    7、开启远程访问: 
    use mysql; 
    update user set host = “%” where user = “root”; 
    flush privileges;

    8、关闭远程访问: 
    use mysql; 
    update user set host = “localhost” where user = “root” and host= “%”; 
    flush privileges;

    9、启动MySQL服务

    sudo /usr/local/MySQL/support-files/mysql.server start

    10、停止MySQL服务

    sudo /usr/local/mysql/support-files/mysql.server stop

    11、重启MySQL服务

    sudo /usr/local/mysql/support-files/mysql.server restart

  • 相关阅读:
    一份简单的自我评述
    从诞总那儿得到的一些感悟
    2021秋软件工项目选题
    LeNet 网络进行猫狗大战
    不平行的直线
    切长条
    纪念品分组
    奇♂妙拆分
    Qt 一些日期格式转换不精确
    windbg 查看崩溃日志
  • 原文地址:https://www.cnblogs.com/PeterWolf/p/9198966.html
Copyright © 2011-2022 走看看