MySQL client tools and common SQL statements

Source: Internet
Author: User
Tags mysql client

MySQL Client tool:
    在用yum安装的maiadb-server的时候,在/etc/my.cnf.d下有一个名为client.cnf的文件,编辑此文件,在此文件的[client]下添加用户名和密码就可以不用输入口令登录        vim /etc/my.cnf.d/client.cnf            [client]            user=root                        # 登录数据库使用的用户名            password=mysql          #登录数据库使用的密码
Most common SQL statements

1 Create Users and view (SQL statements);

        create user [email protected]‘192.168.27.%‘ identified by ‘fang‘;        #创建fang用户并且赋予密码为fang,整个27网段的用户都可以连接此数据库;,默认只有连接功能        select user,password,host from mysql.user;                   #创建的用户信息会存放在mysql库中的user表中,使用此sql可查看创建的用户;

2 remote host connection to database server (Linux command);

        mysql -ufang -pfang -h192.168.27.105                         #-u指定连接用户;-p指定连接密码;-h指定连接的主机;

3 Viewing user information (SQL statements) that are connected to the database server for work;

    show processlist;

4 Viewing the user (SQL statement) currently connected to the database running;

        select user();

5 Viewing the status of the current database (SQL statement)

        status

6 view MySQL This command is the default connection database with parameters (Linux command);

        mysql --print-defaults

There are also most of the SQL statements in this no longer an example, when the later encounter situation lookup syntax is OK;

MySQL client tools and common SQL statements

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.