Environment variables for MySQL

Source: Internet
Author: User
Tags mysql client

Environment variables for MySQL

    • Server variables: Adjust MySQL's working properties, determined by the MySQL configuration file
    • State variables: Self-statistics that are output after MySQL runs

View MySQL's environment variables under Linux

1. Get MySQL client Help

#/usr/local/mysql/bin/mysql–help–v (in the Help message--is the MySQL client command, not--is the MySQL server variable)

Reading order of 2.MySQL configuration files

/etc/my.cnf >/etc/mysql/my.cnf >/usr/local/mysql/etc/my.cnf (Find configuration files in this order)

Note: The end result is a collection of all profiles, the same option is valid at the last read

To view the global variables for MySQL:

To view the environment variables currently connected to MySQL:

User management for MySQL

Tip: View user passwords in MySQL

1. Create a user

GRANT all on * * to ' localhost '; (anonymous user created)

2. Change user password

UPDATE mysql.user SET password= ' where user= ' root ' and host= ' localhost ';

3. Delete a user

Mode one: DELETE from Mysql.user WHERE password= ' and user= ' root ';

Mode two: DROP user @ Host

Wildcard characters for Ps:mysql

%: All Users

_: Any character of a unit length (note a unit length)

Set User settings password
1. Set a password for the user individually
Format:
SET PASSWORD for ' UserName ' @ ' HostName ' = PASSWORD (' Newpss ')
2. Batch modify passwords for multiple users
Format:
UPDATE mysql.user SET password= ' newpass ' WHERE condition
3. Using a MySQL client tool-mysqladmin
Format:
Mysqladmin-u User-P old password Password new password-h host
Note: The host here refers to the user can use this password to log on to the host on the MySQL

MySQL client and server-side communication
1, local communication: MySQL client and server side on the same host, and to be based on the LO interface or 127.0.0.1 communication.
Linux System (Unix sock)
            compile installation:/tmp/ Mysql.sock
            RPM Installation:/var/lib/mmysql/ Mysql.sock
Windows
            memory
             Pipe
2, remote communication: MySQL client and server side on the same host, but the communication is based on IP communication , or the client and server side are not on the same host.
Socket:ip+port
Common clients
    mysql
    mysqladmin
    Common options for Mydqldump
    mysqlcheck       
Client Tools
    -u--user=
   -H--host=
   -P--password=
   - -port=
   --protocol={socket|memory|pipe}
   --socket=

MySQL
    two modes of operation
    1, interactive mode
         MySQL >
    2, Batch mode
        # mysql-u root-p123 < ; 1.sql
   
Commands available in interactive mode
    server-side commands:
         access: Help COMMAND;
    Client commands:
        \h
         \c
        \g
        \g
        \q
        \s
         \!
        \#
Queries the keywords available to MYQL clients:
Help contents;  


MySQL Client-only options
-C or-compress: Compressed transport
--DEFAULT-CHARACTER-SET=NAME Specifies the type of character set used by the MySQL client.
-E,--execute=name: Execute mysql command in bash
-H or--html: output results as Web pages

The MySQL prompt
MySQL >
Line-continuation character
/*> annotation Characters
' >

MySQL operation log
~/.mysql_history

MySQL shortcut keys
Ctrl+w: One word before each deletion of the cursor
Ctrl+u: Delete all before the cursor
Ctrl+y: Pasting
CTRL + A: Cursor moves to the beginning of the line
Ctrl+e: Cursor moves to end of line

Environment variables for MySQL

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.