zoukankan      html  css  js  c++  java
  • mysql的程序组成

    mysql的程序组成

    客户端与服务的程序

    1. 客户端
    • mysql:CLI交互式客户端程序
    • mysql_secure_installation:安全初始化,强烈建议安装完以后执行此命令
    • mysqldump:mysql备份工具
    • mysqladmin
    1. 服务器端
    • mysqld

    mysql工具使用

    1. 语法:mysql [OPTIONS] [database]
    常用的OPTIONS:
        -uUSERNAME      //指定用户名,默认为root
        -hHOST          //指定服务器主机,默认为localhost,推荐使用ip地址
        -pPASSWORD      //指定用户的密码
        -P#             //指定数据库监听的端口,这里的#需用实际的端口号代替,如-P3306
        -V              //查看当前使用的mysql版本
        -e              //不登录mysql执行sql语句后退出,常用于脚本
        -S              //指定套接字的路径
    
    1. 实例
    [root@localhost ~]# mysql -V
    mysql  Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1
    
    
    
    [root@localhost ~]# mysql -uroot -p123456 -h127.0.0.1
    Welcome to the MariaDB monitor.  Commands end with ; or g.
    Your MariaDB connection id is 4
    Server version: 5.5.68-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    MariaDB [(none)]> 
    
    
    
    [root@localhost ~]# mysql -uroot -p123456 -P3306
    Welcome to the MariaDB monitor.  Commands end with ; or g.
    Your MariaDB connection id is 6
    Server version: 5.5.68-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    MariaDB [(none)]> 
    
    
    
    [root@localhost ~]# mysql -u root -p -e 'show databases;'
    Enter password: 
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | test               |
    +--------------------+
    
    

    服务器监听的两种socket地址

    1. ip socket
    • 默认监听在tcp的3306端口,支持远程通信
    1. unix sock
    • 监听在sock文件上(/tmp/mysql.sock,/var/lib/mysql/mysql.sock
    • 仅支持本地通信
    • server地址只能是:localhost,127.0.0.1
  • 相关阅读:
    蓝桥杯 全球变暖(dfs)
    Bzoj3196 Tyvj 1730 二逼平衡树
    Bzoj3110 [Zjoi2013]K大数查询
    Bzoj4004 [JLOI2015]装备购买
    Bzoj2115 [Wc2011] Xor
    Bzoj1257 [CQOI2007]余数之和sum
    HDU1724 Ellipse
    Bzoj2178 圆的面积并
    SPOJ CIRU The area of the union of circles
    CodeForces 232E.Quick Tortoise
  • 原文地址:https://www.cnblogs.com/itwangqiang/p/14236213.html
Copyright © 2011-2022 走看看