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

  • 相关阅读:
    linux Segmentation faults 段错误详解
    linux cut
    linux sed
    linux tr
    linux ar
    objdump--反汇编查看
    linux中dd命令
    readelf
    登录后,前端做了哪些工作,如何得知已登录?
    正向代理和反向代理?
  • 原文地址:https://www.cnblogs.com/PeterWolf/p/9198966.html
Copyright © 2011-2022 走看看